MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / add_edge

Method add_edge

easygraph/classes/directed_graph.py:649–684  ·  view source on GitHub ↗

Add a directed edge. Parameters ---------- u_of_edge : object The start end of this edge v_of_edge : object The destination end of this edge edge_attr : keywords arguments, optional The attribute of the edge. Not

(self, u_of_edge, v_of_edge, **edge_attr)

Source from the content-addressed store, hash-verified

647 self._node[node].update(node_attr)
648
649 def add_edge(self, u_of_edge, v_of_edge, **edge_attr):
650 """Add a directed edge.
651
652 Parameters
653 ----------
654 u_of_edge : object
655 The start end of this edge
656
657 v_of_edge : object
658 The destination end of this edge
659
660 edge_attr : keywords arguments, optional
661 The attribute of the edge.
662
663 Notes
664 -----
665 Nodes of this edge will be automatically added to the graph, if they do not exist.
666
667 See Also
668 --------
669 add_edges
670
671 Examples
672 --------
673
674 >>> G.add_edge(1,2)
675 >>> G.add_edge('Jack', 'Tom', weight=10)
676
677 Add edge with attributes, edge weight, for example,
678
679 >>> G.add_edge(1, 2, **{
680 ... 'weight': 20
681 ... })
682
683 """
684 self._add_one_edge(u_of_edge, v_of_edge, edge_attr)
685
686 def add_weighted_edge(self, u_of_edge, v_of_edge, weight):
687 self._add_one_edge(u_of_edge, v_of_edge, edge_attr={"weight": weight})

Callers 15

add_edges_from_fileMethod · 0.95
condensationFunction · 0.95
TransitionFunction · 0.95
_dfs_cycle_forestFunction · 0.95
createAFunction · 0.95
test_clusteringMethod · 0.95
_find_topk_shs_under_lFunction · 0.95
_find_ancestors_of_nodeFunction · 0.95
parse_pajekFunction · 0.95
copyMethod · 0.45

Calls 1

_add_one_edgeMethod · 0.95

Tested by 1

test_clusteringMethod · 0.76