Recursive Search for All Possible Paths Between 2 Nodes

조회 수: 4 (최근 30일)
czeslaw
czeslaw 2018년 1월 31일
댓글: Can Chen 2020년 6월 5일
Hi all,
I am trying to look if there is any existing function or codes that can help me to find all possible paths from a starting node to a target node. The only restrictions is that the traveller cannot travel to any previously travelled path or vertex. I imagine this will need a recursive function if the path has some branches to check all possible paths to destination in each intersection.
The ideal input format would be function(coordinates, NodeConnectivityMatrix, startnode, targetnode).
The ideal output format would contain sets of vectors with NodeIndices describing all possible paths.
Please any suggestion. Thank you.
  댓글 수: 1
Can Chen
Can Chen 2020년 6월 5일
Hi czeslaw, I work at MathWorks on graphs. If you have a few minutes, I would very much appreciate hearing more about your workflow using paths. Would you please contact me directly? Thanks.

댓글을 달려면 로그인하십시오.

답변 (1개)

Peter Cook
Peter Cook 2018년 2월 1일
You should check out the graph class. https://www.mathworks.com/help/matlab/ref/graph.html
Most common graph operations are implemented
>> methods graph
Methods for class graph:
addedge centrality findnode maxflow plot subgraph
addnode conncomp graph minspantree reordernodes
adjacency degree incidence nearest rmedge
bctree dfsearch isisomorphic neighbors rmnode
bfsearch distances isomorphism numedges shortestpath
biconncomp findedge laplacian numnodes shortestpathtree
If need more graph methods than that and you have the python networkx library somewhere on your machine, you can create a nx graph like this and use whatever nx methods you want with dot notation:
g = py.networkx.Graph()

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by