Zum Inhalt

graphimporter

dsstools.graphimporter

GraphImporter(identifier=None, *, token=None, api='https://dss-wdc.wiso.uni-hamburg.de/api', insecure=False, timeout=60, params=None)

Bases: WDC

Class enabling graph imports from the WDC server. Args: identifier: Identifier of the network data. This is a numeric ID identifying the graph. Unintuitively, this differs from the corresponding text search data, if you need both data types. token: Token for authorization. api: API address to send request to. Leave this as is. insecure: Hide warning regarding missing https. timeout: Set the timeout to the server. Increase this if you request large networks. params: These are additional keyword arguments passed onto the API endpoint. See https://dss-wdc.wiso.uni-hamburg.de/#_complex_datatypes_for_the_api_requests for further assistance.

token property writable

Get the password token.

get_edges()

Get the edges of the selected graph.

Args:

Returns:

Type Description

List of edges, containing a 3-tuple of the structure (from,

to, weight).

get_graph(graph_type=nx.DiGraph)

Get the full graph containing nodes and edges.

Parameters:

Name Type Description Default
graph_type

Type of graph to create. (Default value = nx.DiGraph)

DiGraph

Returns:

Type Description

Graph from API

get_nodes()

Get the nodes of the selected graph.

Args:

Returns:

Type Description

List of nodes, containing a 2-tuple of the structure (ID,

{additional_data_dict}).

list_available_graphs()

List available graphs for the current token.

Returns:

Type Description
list[dict]

List of dicts containing the graphs with metadata.

read_wdcapi(identifier, token, timeout=60, graph_type=nx.DiGraph)

Import a graph from the WDC API.

Parameters:

Name Type Description Default
identifier str

str: Identifier of the graph.

required
token str

str: Token to authenticate with.

required
timeout int

int: Timeout in seconds after the request cancels. For very large graphs this should be increased. (Default value = 60)

60
graph_type

Type of graph to return. For crawled graphs nx.DiGraph is recommended. (Default value = nx.DiGraph)

DiGraph

Returns:

Type Description

The imported graph.

read_wdcapi_graphs(token, timeout=60)

List accessible graph identifiers for the given token.

Use the identifier in read_wdcapi().

Parameters:

Name Type Description Default
token str

str: Token to authenticate with.

required
timeout int

int: Timeout in seconds after the request cancels. Leave at default. (Default value = 60)

60

Returns: