Skip to main content
2 of 2
images
Federico Poloni
  • 20.2k
  • 2
  • 82
  • 120

What you ask for is an unsolvable problem, because it depends on the embedding of the graph in the plane (or space). Consider the following graphs:

     enter image description here      enter image description here

They are isomorphic, and described by the same node-edge incidence matrix, but you want different answers for them.

You need to specify a planar embedding (i.e., coordinates for the vertices) for this to work.

Federico Poloni
  • 20.2k
  • 2
  • 82
  • 120