How to use the pygraphviz.graphviz.agnxtout function in pygraphviz

To help you get started, we’ve selected a few pygraphviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
yield (e[0],e[1],e.name)
                    else:
                        yield e
                    eh=gv.agnxtout(self.handle,eh)
                nh=gv.agnxtnode(self.handle,nh)
        elif nbunch in self: # if nbunch is a single node
            n=Node(self,nbunch)
            nh=n.handle
            eh=gv.agfstout(self.handle,nh)
            while eh is not None:
                e=Edge(self,eh=eh)
                if keys:
                    yield (e[0],e[1],e.name)
                else:
                    yield e
                eh=gv.agnxtout(self.handle,eh)
        else:                # if nbunch is a sequence of nodes
            try: bunch=[n for n in nbunch if n in self]
            except TypeError:
                raise TypeError("nbunch is not a node or a sequence of nodes.")
            for n in nbunch:
                try:
                    nh=Node(self,n).handle
                except KeyError:
                    continue
                eh=gv.agfstout(self.handle,nh)
                while eh is not None:
                    e=Edge(self,eh=eh)
                    if keys:
                        yield (e[0],e[1],e.name)
                    else:
                        yield e
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
except TypeError:
                raise TypeError("nbunch is not a node or a sequence of nodes.")
            for n in nbunch:
                try:
                    nh = Node(self, n).handle
                except KeyError:
                    continue
                eh = gv.agfstout(self.handle, nh)
                while eh is not None:
                    e = Edge(self, eh=eh)
                    if keys:
                        yield (e[0], e[1], e.name)
                    else:
                        yield e
                    try:
                        eh = gv.agnxtout(self.handle, eh)
                    except StopIteration:
                        break
github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
Note: modifying the graph structure while iterating over
        edges may produce unpredictable results.  Use out_edges()
        as an alternative.
        """

        if nbunch is None:   # all nodes
            nh=gv.agfstnode(self.handle)
            while nh is not None:
                eh=gv.agfstout(self.handle,nh)
                while eh is not None:
                    e=Edge(self,eh=eh)
                    if keys:
                        yield (e[0],e[1],e.name)
                    else:
                        yield e
                    eh=gv.agnxtout(self.handle,eh)
                nh=gv.agnxtnode(self.handle,nh)
        elif nbunch in self: # if nbunch is a single node
            n=Node(self,nbunch)
            nh=n.handle
            eh=gv.agfstout(self.handle,nh)
            while eh is not None:
                e=Edge(self,eh=eh)
                if keys:
                    yield (e[0],e[1],e.name)
                else:
                    yield e
                eh=gv.agnxtout(self.handle,eh)
        else:                # if nbunch is a sequence of nodes
            try: bunch=[n for n in nbunch if n in self]
            except TypeError:
                raise TypeError("nbunch is not a node or a sequence of nodes.")
github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
try: bunch=[n for n in nbunch if n in self]
            except TypeError:
                raise TypeError("nbunch is not a node or a sequence of nodes.")
            for n in nbunch:
                try:
                    nh=Node(self,n).handle
                except KeyError:
                    continue
                eh=gv.agfstout(self.handle,nh)
                while eh is not None:
                    e=Edge(self,eh=eh)
                    if keys:
                        yield (e[0],e[1],e.name)
                    else:
                        yield e
                    eh=gv.agnxtout(self.handle,eh)
        raise StopIteration
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
try:
                    nh = gv.agnxtnode(self.handle, nh)
                except StopIteration:
                    return
        elif nbunch in self: # if nbunch is a single node
            n = Node(self, nbunch)
            nh = n.handle
            eh = gv.agfstout(self.handle, nh)
            while eh is not None:
                e = Edge(self, eh=eh)
                if keys:
                    yield (e[0], e[1], e.name)
                else:
                    yield e
                try:
                    eh = gv.agnxtout(self.handle, eh)
                except StopIteration:
                    return
        else:                # if nbunch is a sequence of nodes
            try:
                bunch = [n for n in nbunch if n in self]
            except TypeError:
                raise TypeError("nbunch is not a node or a sequence of nodes.")
            for n in nbunch:
                try:
                    nh = Node(self, n).handle
                except KeyError:
                    continue
                eh = gv.agfstout(self.handle, nh)
                while eh is not None:
                    e = Edge(self, eh=eh)
                    if keys:
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
Note: modifying the graph structure while iterating over
        node successors may produce unpredictable results.  Use
        successors() as an alternative.
        """
        n = Node(self, n)
        nh = n.handle
        eh = gv.agfstout(self.handle, nh)
        while eh is not None:
            (s, t) = Edge(self, eh=eh)
            if s == n:
                yield Node(self, t)
            else:
                yield Node(self, s)
            try:
                eh = gv.agnxtout(self.handle, eh)
            except StopIteration:
                return
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
edges may produce unpredictable results.  Use out_edges()
        as an alternative.
        """

        if nbunch is None:   # all nodes
            nh = gv.agfstnode(self.handle)
            while nh is not None:
                eh = gv.agfstout(self.handle, nh)
                while eh is not None:
                    e = Edge(self, eh=eh)
                    if keys:
                        yield (e[0], e[1], e.name)
                    else:
                        yield e
                    try:
                        eh = gv.agnxtout(self.handle, eh)
                    except StopIteration:
                        break
                try:
                    nh = gv.agnxtnode(self.handle, nh)
                except StopIteration:
                    return
        elif nbunch in self: # if nbunch is a single node
            n = Node(self, nbunch)
            nh = n.handle
            eh = gv.agfstout(self.handle, nh)
            while eh is not None:
                e = Edge(self, eh=eh)
                if keys:
                    yield (e[0], e[1], e.name)
                else:
                    yield e