SciPy

tethne.persistence.hdf5.graphcollection module

class tethne.persistence.hdf5.graphcollection.HDF5EdgeAttributes(h5file, pgroup, edges)[source]

Bases: object

get_edges(data=False)[source]
items()[source]
class tethne.persistence.hdf5.graphcollection.HDF5Graph(h5file, pgroup, name, graph)[source]

Bases: networkx.classes.graph.Graph

add_edge(*args, **kwargs)[source]
add_node(*args, **kwargs)[source]
edges(data=False)[source]
nodes(data=False)[source]
to_graph()[source]

Convert HDF5Graph to a networkx.Graph.

Returns:graph : networkx.Graph
class tethne.persistence.hdf5.graphcollection.HDF5GraphCollection(G=None, datapath=None)[source]

Bases: tethne.classes.graphcollection.GraphCollection

Provides HDF5 persistence for GraphCollection.

At this time, the HDF5GraphCollection should only be used for storing existing GraphCollection, and NOT for direct manipulation.

class tethne.persistence.hdf5.graphcollection.HDF5NodeAttributes(h5file, pgroup, attributes=None)[source]

Bases: object

get_nodes(data=False)[source]
items()[source]
class tethne.persistence.hdf5.graphcollection.SparseArray(h5file, pgroup, name, I, J, K)[source]

Bases: object

get_edges(data=False)[source]
get_neighbors(i)[source]
nodes()[source]

Return a list of nodes for which there are edge data.

Returns:nodes : list
num_edges()[source]
tethne.persistence.hdf5.graphcollection.from_hdf5(HD_or_path)[source]

Load a GraphCollection from a HDF5GraphCollection.

Parameters:

HD_or_path : str or GraphCollection

If str, must be a path to a GraphCollection HDF5 repo.

Returns:

G : GraphCollection

Examples

From a path:

>>> model = from_hdf5('/path/to/my/HDF5LDAModel.h5')
tethne.persistence.hdf5.graphcollection.to_hdf5(G, datapath=None)[source]