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

Method add_node

easygraph/classes/directed_graph.py:489–520  ·  view source on GitHub ↗

Add one node Add one node, type of which is any hashable Python object, such as int, string, dict, or even Graph itself. You can add with node attributes using Python dict type. Parameters ---------- node_for_adding : any hashable Python object N

(self, node_for_adding, **node_attr)

Source from the content-addressed store, hash-verified

487 print("No node {}".format(node))
488
489 def add_node(self, node_for_adding, **node_attr):
490 """Add one node
491
492 Add one node, type of which is any hashable Python object, such as int, string, dict, or even Graph itself.
493 You can add with node attributes using Python dict type.
494
495 Parameters
496 ----------
497 node_for_adding : any hashable Python object
498 Nodes for adding.
499
500 node_attr : keywords arguments, optional
501 The node attributes.
502 You can customize them with different key-value pairs.
503
504 See Also
505 --------
506 add_nodes
507
508 Examples
509 --------
510 >>> G.add_node('a')
511 >>> G.add_node('hello world')
512 >>> G.add_node('Jack', age=10)
513
514 >>> G.add_node('Jack', **{
515 ... 'age': 10,
516 ... 'gender': 'M'
517 ... })
518
519 """
520 self._add_one_node(node_for_adding, node_attr)
521
522 def add_nodes(self, nodes_for_adding: list, nodes_attr: List[Dict] = []):
523 """Add nodes with a list of nodes.

Callers 9

condensationFunction · 0.95
_dfs_cycle_forestFunction · 0.95
_find_topk_shs_under_lFunction · 0.95
_find_ancestors_of_nodeFunction · 0.95
parse_pajekFunction · 0.95
copyMethod · 0.45
nodes_subgraphMethod · 0.45
to_index_node_graphMethod · 0.45
cppMethod · 0.45

Calls 1

_add_one_nodeMethod · 0.95

Tested by

no test coverage detected