You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Make the graph undirected, i.e. for every edge from A to B, there exists an edge from B to A."
My expectation would be that if a graph has an edge from C to C, then well, in undirected form it will still have an edge from C to C, and that's it (concerning that self-edge). Except, I noticed something different. Here is a piece of code I had, with printing added for debugging:
print theNodes
print theEdges
let numberedNodes =zip [0..] theNodes
let graph = undir (mkGraph numberedNodes theEdges) ::GrStringStringprint graph
I get how the edges (3,0,"z"),(3,1,"z") before undir turn into (0,3,"z"),(1,3,"z"),(3,0,"z"),(3,1,"z") after it.
But why was the original edge (3,3,"y") duplicated into (3,3,"y"),(3,3,"y")? That seems uncalled for (and led to a wrong picture when feeding this graph into GraphViz).
The text was updated successfully, but these errors were encountered:
According to the documentation of
undir
, we get:"Make the graph undirected, i.e. for every edge from A to B, there exists an edge from B to A."
My expectation would be that if a graph has an edge from C to C, then well, in undirected form it will still have an edge from C to C, and that's it (concerning that self-edge). Except, I noticed something different. Here is a piece of code I had, with printing added for debugging:
And here is the printed output:
Note the double occurrence of
(3,3,"y")
in there.I get how the edges
(3,0,"z"),(3,1,"z")
beforeundir
turn into(0,3,"z"),(1,3,"z"),(3,0,"z"),(3,1,"z")
after it.But why was the original edge
(3,3,"y")
duplicated into(3,3,"y"),(3,3,"y")
? That seems uncalled for (and led to a wrong picture when feeding this graph intoGraphViz
).The text was updated successfully, but these errors were encountered: