Giter Club home page Giter Club logo

adigraph's Introduction

Adigraph

Build status Version License Available in Available in

Adigraph is a pure latex library for drawing directed graphs and augmenting directed graphs, and to draw cuts over them. It DOES NOT require external libraries such as Graphviz or DOT.

It handles automatically the positioning of labels, with the exception of the horizontal position, and the inclinations of cuts.

This library is released under MIT license (Copyright 2018 Luca Cappelletti).

Documentation

For more information, you can read the documentation available here

Basic setup

Installing the package

If you are on Linux or macOs you can run the following.

sudo tlmgr install fp etoolbox adigraph

Otherwise install the packages with the package manager of your choice.

Checking the version

All recent (1.3+) Adigraph versions offer the following command:

\AdigraphVersionNumber

If you get an Undefined control sequence error you have a version previous to 1.3, you should consider updating it manually.

An approach could be the following:

  1. Download the latest version from ctan: here.
  2. Identify the position of the installed adigraph by running find / -type d -name adigraph.
  3. Replace the old adigraph.sty with the new adigraph.sty downloaded from ctan.

Requiring the package in the document

Remember to require the package in the document.

\usepackage{adigraph}

Basic example

More examples and step by step explanation is available in the documentation.

Suppose you want to create a graph as the following, with an augmenting path highlighted and a couple of cuts:

Basic example

We start by defining a new graph, called myAdigraph:

\NewAdigraph{myAdigraph}{
    s:0,0;
    1:2,2;
    3:2,-2;
    2:6,2;
    4:6,-2;
    t:8,0;
}{
    s,1:25;
    s,3:25;
    3,4:25;
    1,2:35;
    2,t:20;
    4,t:30;
    3,1:10;
    4,2:10;
    2,3:15::near start;
    4,1:5::near start;
}

At this point the output is the following:

\myAdigraph{}

First adigraph

Then we can add the augmenting path as follows:

\myAdigraph{
    s,3,4,2,t:5;
}

Augmenting adigraph

And the cuts (remember that the paths from previous steps are memorized by the library) are added as follows:

\myAdigraph{}{
    2,t,red;
    3,4,blue;
}

The result with the cuts is the following:

Cuts adigraph

You can add both cuts and paths at the same time to keep the latest path highlighted:

\myAdigraph{
    s,3,4,2,t:5;
}{
    2,t,red;
    3,4,blue;
}

Cuts adigraph

Have a nice day!

Luca Cappelletti

adigraph's People

Contributors

lucacappelletti94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gobigorgohome

adigraph's Issues

Nodes same size

Is it possible to adjust the nodes size in a way that they have all the same size? This applies especially when the text is not just one single character but longer (and multi line [e. g. {\shortstack{test\\multi\\line}}).

According to https://tex.stackexchange.com/a/349344/48642 it shouldn't be that hard to accomplish.

BTW: I personally don't see a reason why they should have different size at all!

What happend?

image

\NewAdigraph{myAdigraph}{
    s:0,0;
    1:2,2;
    3:2,-2;
    2:6,2;
    4:6,-2;
    t:8,0;
}{
    s,1:25;
    s,3:25;
    3,4:25;
    1,2:35;
    2,t:20;
    4,t:30;
    3,1:10;
    4,2:10;
    2,3:15::near start;
    4,1:5::near start;
}
\myAdigraph{}{
    2,t,red;
    3,4,blue;
}
\end{figure}

TikZ names of nodes

Is it possible to obtain the TikZ names of nodes?

Why?

This will allow decorating graphs using directly TikZ: see the package nicematrix which has this killer feature.

Thanks for all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.