pygraph.classes.hypergraph.hypergraph

Package pygraph :: Package classes :: Module hypergraph :: Class hypergraph |

# Class hypergraph

Hypergraph class.

Hypergraphs are a generalization of graphs where an edge (called hyperedge) can connect more than two nodes.

Instance Methods
__init__(self) Initialize a hypergraph. |
add_hyperedge(self, hyperedge) Add given hyperedge to the hypergraph. |
add_hyperedges(self, edgelist) Add given hyperedges to the hypergraph. |
add_node(self, node) Add given node to the hypergraph. |
del_edge(self, hyperedge) Delete the given hyperedge. |
boolean |
has_node(self, node) Return whether the requested node exists. |
boolean |
has_edge(self, hyperedge) Return whether the requested node exists. |
boolean |
has_hyperedge(self, hyperedge) Return whether the requested node exists. |
list |
hyperedges(self) Return hyperedge list. |
link(self, node, hyperedge) Link given node and hyperedge. |
list |
links(self, obj) Return all nodes connected by the given hyperedge or all hyperedges connected to the given hypernode. |
list |
nodes(self) Return node list. |
unlink(self, node, hyperedge) Unlink given node and hyperedge. |
list |
edges(self) Return the hyperedge list. |
list |
neighbors(self, obj) Return all neighbors adjacent to the given node. |
del_node(self, node) Delete a given node from the hypergraph. |
add_edge(self, hyperedge) Add given hyperedge to the hypergraph. |
add_edges(self, edgelist) Add given hyperedges to the hypergraph. |
del_hyperedge(self, hyperedge) Delete the given hyperedge. |
int |
rank(self) Return the rank of the given hypergraph. |
boolean |
__eq__(self, other) Return whether this hypergraph is equal to another one. |
boolean |
__ne__(self, other) Return whether this hypergraph is not equal to another one. |
Inherited from `mixins.common.common`: `__len__`, `__str__`, `add_nodes`, `__getitem__`, `__iter__`, `__repr__`, `add_graph`, `add_spanning_tree`, `complete`, `inverse`, `order`, `reverse` Inherited from `mixins.labeling.labeling`: `add_edge_attribute`, `add_edge_attributes`, `add_node_attribute`, `del_edge_labeling`, `del_node_labeling`, `edge_attributes`, `edge_label`, `edge_weight`, `get_edge_properties`, `node_attributes`, `set_edge_label`, `set_edge_properties`, `set_edge_weight` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Variables
| DIRECTED = `True`
Inherited from `mixins.labeling.labeling`: `DEFAULT_LABEL`, `DEFAULT_WEIGHT`, `LABEL_ATTRIBUTE_NAME`, `WEIGHT_ATTRIBUTE_NAME`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self) (Constructor) |
Initialize a hypergraph. Overrides: object.__init__

### add_hyperedge(self, hyperedge) |
Add given hyperedge to the hypergraph. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier. Attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write().

### add_hyperedges(self, edgelist) |
Add given hyperedges to the hypergraph. Parameters: `edgelist` (list) - List of hyperedge-nodes to be added to the graph. Attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write().

### add_node(self, node) |
Add given node to the hypergraph. Parameters: `node` (node) - Node identifier. Attention: While nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write().

### del_edge(self, hyperedge) |
Delete the given hyperedge. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier.

### has_node(self, node) |
Return whether the requested node exists. Parameters: `node` (node) - Node identifier Returns: boolean Truth-value for node existence.

### has_edge(self, hyperedge) |
Return whether the requested node exists. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier Returns: boolean Truth-value for hyperedge existence.

### has_hyperedge(self, hyperedge) |
Return whether the requested node exists. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier Returns: boolean Truth-value for hyperedge existence.

### hyperedges(self) |
Return hyperedge list. Returns: list List of hyperedges in the graph.

### link(self, node, hyperedge) |
Link given node and hyperedge. Parameters: `node` (node) - Node. `hyperedge` (node) - Hyperedge.

### links(self, obj) |
Return all nodes connected by the given hyperedge or all hyperedges connected to the given hypernode. Parameters: `obj` (hyperedge) - Object identifier. Returns: list List of node objects linked to the given hyperedge.

### nodes(self) |
Return node list. Returns: list Node list.

### unlink(self, node, hyperedge) |
Unlink given node and hyperedge. Parameters: `node` (node) - Node. `hyperedge` (hyperedge) - Hyperedge.

### edges(self) |
Return the hyperedge list. Returns: list List of hyperedges in the graph.

### neighbors(self, obj) |
Return all neighbors adjacent to the given node. Parameters: `obj` (node) - Object identifier. Returns: list List of all node objects adjacent to the given node.

### del_node(self, node) |
Delete a given node from the hypergraph. Parameters: `node` (node) - Node identifier.

### add_edge(self, hyperedge) |
Add given hyperedge to the hypergraph. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier. Attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write().

### add_edges(self, edgelist) |
Add given hyperedges to the hypergraph. Parameters: `edgelist` (list) - List of hyperedge-nodes to be added to the graph. Attention: While hyperedge-nodes can be of any type, it's strongly recommended to use only numbers and single-line strings as node identifiers if you intend to use write().

### del_hyperedge(self, hyperedge) |
Delete the given hyperedge. Parameters: `hyperedge` (hyperedge) - Hyperedge identifier.

### rank(self) |
Return the rank of the given hypergraph. Returns: int Rank of graph.

### __eq__(self, other) (Equality operator) |
Return whether this hypergraph is equal to another one. Parameters: `other` (hypergraph) - Other hypergraph Returns: boolean Whether this hypergraph and the other are equal. Overrides: mixins.labeling.labeling.__eq__

### __ne__(self, other) |
Return whether this hypergraph is not equal to another one. Parameters: `other` (hypergraph) - Other hypergraph Returns: boolean Whether this hypergraph and the other are different.