![]() |
Quantum Fog
0.9.3
|
Public Member Functions | |
def | __init__ (self, nodes) |
def | add_nodes (self, nodes) |
def | has_node (self, node) |
def | contains (self, nodes) |
def | unmark_all_nodes (self) |
def | get_node_named (self, name) |
def | get_node_with_id_num (self, id_num) |
def | get_node_with_topo_index (self, topo_index) |
def | get_nx_graph (self) |
def | draw (self, algo_num, kwargs) |
def | write_dot (self, path) |
def | read_dot (cls, path) |
Static Public Member Functions | |
def | new_from_nx_graph (nx_graph) |
Public Attributes | |
nodes | |
Graph is the parent of all other graph classes. It's just a set of nodes. The nodes themselves will keep track of their neighbors, parents, children, etc. In general, Quantum Fog will use the words 'nodes' and 'subnodes' for sets of nodes. For lists of nodes, we will use either 'node_list' or 'ord_nodes'. Attributes ---------- nodes : set[Node]
def graphs.Graph.Graph.__init__ | ( | self, | |
nodes | |||
) |
Constructor Parameters ---------- nodes : set[Node] Returns -------
def graphs.Graph.Graph.add_nodes | ( | self, | |
nodes | |||
) |
Add a set 'nodes' to existing set 'self.nodes'. Parameters ---------- nodes : set[Node] Returns ------- None
def graphs.Graph.Graph.contains | ( | self, | |
nodes | |||
) |
Answer the question of whether set 'nodes' is a subset of 'self.nodes'. Parameters ---------- nodes : set[Node] Returns ------- bool
def graphs.Graph.Graph.draw | ( | self, | |
algo_num, | |||
kwargs | |||
) |
This method works both for undirected and directed graphs. It produces a plot of the self graph using only standard Python libraries like matplotlib. Does not require that the fantastic & free graphviz app be installed on your computer. If you want to use graphviz to get a more finely tuned plot, use the write_dot() method to generate a dot file which you can then fiddle with using the graphviz app itself. Parameters ---------- algo_num : int From 1 to 6, algorithm used to determine node positions **kwargs : unpacked dictionary Look at the numerous keyword arguments of the function draw_networkx() in the networkx package. You can pass the same key-value pairs into this draw() method. Returns -------
def graphs.Graph.Graph.get_node_named | ( | self, | |
name | |||
) |
Tries to find the node called 'name'. Parameters ---------- name : str Returns ------- Node
def graphs.Graph.Graph.get_node_with_id_num | ( | self, | |
id_num | |||
) |
Tries to find the node with this id_num. Parameters ---------- id_num : int Returns ------- Node
def graphs.Graph.Graph.get_node_with_topo_index | ( | self, | |
topo_index | |||
) |
Tries to find the node with this topo_index. Parameters ---------- topo_index : int Returns ------- Node
def graphs.Graph.Graph.get_nx_graph | ( | self | ) |
Returns an nx_graph built from self info. Returns ------- networkx Graph
def graphs.Graph.Graph.has_node | ( | self, | |
node | |||
) |
Answer the question of whether 'node' is in 'self.nodes'. Parameters ---------- node : Node Returns ------- bool
|
static |
Returns a Graph constructed from nx_graph. Parameters ---------- nx_graph : networkx Graph Returns ------- Graph
def graphs.Graph.Graph.read_dot | ( | cls, | |
path | |||
) |
Reads dot file and returns new cls object, where cls can be Graph, Dag, or BayesNet. Parameters ---------- path : str eg. for Windows, you can use an absolute path like 'C:/Documents and Settings/ROBERT/Desktop/tempo.dot' or a relative one like '../examples_cbnets/tempo.dot' Returns ------- Graph
def graphs.Graph.Graph.unmark_all_nodes | ( | self | ) |
Set the 'visited' flag of all nodes to False. Returns ------- None
def graphs.Graph.Graph.write_dot | ( | self, | |
path | |||
) |
This produces a very basic .dot file that can be opened with graphviz to fine tune its layout details. Parameters ---------- path : str eg. for Windows, you can use an absolute path like 'C:/Documents and Settings/ROBERT/Desktop/tempo.dot' or a relative one like '../examples_cbnets/tempo.dot' Returns ------- None