bw2io.export.gexf
#
Module Contents#
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 |
- 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#
- databasestr
Database name.
- keysstr
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#
- databasestr
Database name.
- include_descendantsbool, optional
Include databases which are linked from
database
. (default False)
Warnings#
include_descendants
is not yet implemented.Raises#
- NotImplemented
If
include_descendants
is True, as this option is not yet implemented.
Methods#
- export()
Export the Gephi XML file.
- get_data(E)
Get the nodes and edges for the Gephi XML file.
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#
- str
Filepath of the created file.
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#
- Elxml.builder.ElementMaker
ElementMaker object for GEXF XML
Returns#
- nodeslxml.etree._Element
GEXF nodes
- edgeslxml.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#
- databasestr
Database name.
- keywordstr
Keyword to search for.
Returns#
- str
The filepath of the exported file.
Examples#
>>> keyword_to_gephi_graph(database='example_db', keyword='foo') '/path/to/example_db.gexf'