0

In an incidence matrix we have:

   e1 e2 e3 e4 e5 e6
v1 1  1  0  0  0  0
v2 0  0  1  1  0  1
v3 0  0  0  0  1  1
v4 1  0  1  0  0  0
v5 0  1  0  1  1  0

To find a path, we should find if the last vertex of and edge i is the start of another edge, and the last of the last edge is the first of the first edge.

Can someone help me to find a solution? I understand very well what it is but not how to implement it!

TylerH
  • 20,799
  • 66
  • 75
  • 101
mpluse
  • 1,857
  • 6
  • 18
  • 25
  • possible duplicate of [Incidence matrix in a Graph with Java](http://stackoverflow.com/questions/16172172/incidence-matrix-in-a-graph-with-java) – jlordo Apr 23 '13 at 20:57
  • Don't you need a start vertex and a stop vertex? Or are you trying to find a [Hamiltonian Path](http://en.wikipedia.org/wiki/Hamiltonian_path) ? – durron597 Apr 23 '13 at 20:58
  • @jlordo not duplicate, the other link is for how to create it – mpluse Apr 23 '13 at 20:59
  • @durron597 I don't search a Hamiltonian path! – mpluse Apr 23 '13 at 21:00
  • Is the start and end vortex given or do you want to find all the paths ? Finding all paths would be a crazy problem. – Arjun Rao Apr 23 '13 at 21:36

1 Answers1

0

What do you determine as a path? Do you want to find out if it's possible to visit all node exactly once?

There are two general ways of searching a path: depth first or breadth first. If you have a look at some of the examples, it shouldn't be too hard to implement yourself.

gerrytan
  • 40,313
  • 9
  • 84
  • 99