bw2io.export.gexf#
Classes#
Export a Gephi graph for a selection of activities from a database. |
|
Export a Gephi graph for a database. |
Functions#
|
Export a Gephi graph for a database for all activities whose names include the string |
Module Contents#
- class bw2io.export.gexf.DatabaseSelectionToGEXF(database, keys)[source]#
Bases:
DatabaseToGEXF
Export a Gephi graph for a selection of activities from a database.
Also includes all inputs for the filtered activities.
- Parameters:
database (str) β Database name.
keys (str) β The activity keys to export.
Examples
>>> dstg = DatabaseSelectionToGEXF(database='example_db', keys=['foo', 'bar'])
- class bw2io.export.gexf.DatabaseToGEXF(database, include_descendants=False)[source]#
Bases:
object
Export a Gephi graph for a database.
- Parameters:
database (str) β Database name.
include_descendants (bool, optional) β Include databases which are linked from
database
. (default False)
Warning
include_descendants
is not yet implemented.- Raises:
NotImplemented β If
include_descendants
is True, as this option is not yet implemented.
Examples
>>> dtg = DatabaseToGEXF(database='example_db', include_descendants=False) >>> dtg.export() '/path/to/example_db.gexf'
>>> dtg = DatabaseToGEXF(database='example_db', include_descendants=True) >>> dtg.get_data() (nodes, edges)
- export()[source]#
Export the Gephi XML file.
- Parameters:
None
- Returns:
Filepath of the created file.
- Return type:
str
Examples
>>> dtg = DatabaseToGEXF(database='example_db', include_descendants=False) >>> dtg.export() '/path/to/example_db.gexf'
- get_data(E)[source]#
Get Gephi nodes and edges.
- Parameters:
E (lxml.builder.ElementMaker) β ElementMaker object for GEXF XML
- Returns:
nodes (lxml.etree._Element) β GEXF nodes
edges (lxml.etree._Element) β GEXF edges
Examples
>>> dtg = DatabaseToGEXF(database='example_db', include_descendants=False) >>> dtg.get_data(E) (nodes, edges)
- bw2io.export.gexf.keyword_to_gephi_graph(database, keyword)[source]#
Export a Gephi graph for a database for all activities whose names include the string
keyword
.- Parameters:
database (str) β Database name.
keyword (str) β Keyword to search for.
- Returns:
The filepath of the exported file.
- Return type:
str
Examples
>>> keyword_to_gephi_graph(database='example_db', keyword='foo') '/path/to/example_db.gexf'