How to use the pygraphviz.graphviz.agedge 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
if v is None: (u,v)=u  # no v given, assume u is an edge tuple
        try:
            uh=Node(self,u).handle
        except:
            self.add_node(u)
            uh=Node(self,u).handle
        try:
            vh=Node(self,v).handle
        except:
            self.add_node(v)
            vh=Node(self,v).handle
        try:
            if key is not None:
                if not self._is_string_like(key):
                    key=str(key)
            eh=gv.agedge(self.handle,uh,vh,key,_Action.create)
            e=Edge(self,eh=eh)
            e.attr.update(**attr)
        except KeyError:
            return None # silent failure for strict graph, already added
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
uh = Node(self, u).handle
        except:
            self.add_node(u)
            uh = Node(self, u).handle
        try:
            vh = Node(self, v).handle
        except:
            self.add_node(v)
            vh = Node(self, v).handle
        if key is not None:
            if not is_string_like(key):
                key = str(key)
            key = key.encode(self.encoding)
        try:
            # new
            eh = gv.agedge(self.handle, uh, vh, key, _Action.create)
        except KeyError:
            # for strict graph, or already added
            eh = gv.agedge(self.handle, uh, vh, key, _Action.find)
        e = Edge(self, eh=eh)
        e.attr.update(**attr)
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
uh = Node(self, u).handle
        try:
            vh = Node(self, v).handle
        except:
            self.add_node(v)
            vh = Node(self, v).handle
        if key is not None:
            if not is_string_like(key):
                key = str(key)
            key = key.encode(self.encoding)
        try:
            # new
            eh = gv.agedge(self.handle, uh, vh, key, _Action.create)
        except KeyError:
            # for strict graph, or already added
            eh = gv.agedge(self.handle, uh, vh, key, _Action.find)
        e = Edge(self, eh=eh)
        e.attr.update(**attr)