Zum Inhalt

forgeimporter

dsstools.forgeimporter

logger = get_logger(__name__) module-attribute

clean_graph_data_attributes(graph)

Replace empty strings in data attributes with np.nan.

import_from_data_forge(slug, snapshot, token, domain='dss-graph.wiso.uni-hamburg.de', cache=True, remove_selfloops=True, contract_redirects=False, explicit_include=False)

Import Graph object from dssCode.

Parameters:

Name Type Description Default
slug str

Name slug of the project (see dssCode-Interface)

required
snapshot str

Snapshot hash

required
domain str

The domain for the API call

'dss-graph.wiso.uni-hamburg.de'
cache (bool, Path, str)

Pass the cache directory. Defaults to temporary dir.

True
remove_selfloops bool

Remove edge selfloops.

True
contract_redirects bool

Contract redirecting nodes into one.

False
explicit_include bool

Include only explicitely marked nodes into graph

False

Returns:

Type Description
DiGraph

nx.DiGraph: Graph with the imported data.

read_from_pickle(folder='', timestamp='')

Read cached graph from directory.

Automatically selects the newest instance, except a timestamp is given.

Parameters:

Name Type Description Default
dir (str, Path)

Path to directory to search for pickles. If empty, default to temp dir.

required
timestamp str

timestamp to explicitely select for.

''

Returns:

Type Description
DiGraph

nx.DiGraph: Graph with the imported data.