Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

representation of graph usig sets and hash in python

    def find_path(graph, start, end, path=[]):
        path = path + [start]
        if start == end:
            return path
        if not graph.has_key(start):
            return None
        for node in graph[start]:
            if node not in path:
                newpath = find_path(graph, node, end, path)
                if newpath: return newpath
        return None
Source by www.python.org #
 
PREVIOUS NEXT
Tagged: #representation #graph #usig #sets #hash #python
ADD COMMENT
Topic
Name
1+9 =