Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you join edges when they go to the same node?

Tags:

graphviz

dot

See the line on the leftmost side of this image.

enter image description here

This isn't a perfect example because the lines don't end on a node, but imagine that there is a node on the bottom left corner of the image. Normally in graphviz if I have a graph like this:

digraph G {
    a->c
    b->c
}

Then I get two separate lines going into c. Is it possible to have these two lines join before they reach c?

like image 218
Cory Klein Avatar asked Jun 26 '13 17:06

Cory Klein


People also ask

What is rule of the nodes how do you connect the edge between two nodes?

A directed edge (i, j) leads from i to j (see also Figures 6.1 and 6.2). An edge is incident on the two nodes it connects. Any two nodes connected by an edge or any two edges connected by a node are said to be adjacent.

Is a node adjacent to itself?

That node is connected to itself, and therefore is its own neighbor. You can also see that nodes 1 and 3 are connected by two edges. Those edges are "parallel edges", or "multiple edges". In other words, several edges are parallel edges if they connect the same pair of nodes.

How do you find the adjacent node in a graph?

In a graph, two vertices are said to be adjacent, if there is an edge between the two vertices. Here, the adjacency of vertices is maintained by the single edge that is connecting those two vertices.


1 Answers

Yes, it is possible to have two lines join before they reach c but, as far as I can see, it requires inserting an invisible node to do it. e.g.:

digraph G {
    x [style=invis, height=0, label=""]
    a->x [dir=none]
    b->x [dir=none]
    x->c
}

... which gives:

enter image description here

like image 60
Simon Avatar answered Sep 30 '22 05:09

Simon