Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.x support for utils, from_networkx #26

Open
cs48a opened this issue Dec 3, 2016 · 1 comment
Open

python 3.x support for utils, from_networkx #26

cs48a opened this issue Dec 3, 2016 · 1 comment

Comments

@cs48a
Copy link

cs48a commented Dec 3, 2016

Hi,

(If I got it right) it seems after using a map function there is an access by index which throws an error in python 3.x as map no longer returns a list.

`
if layout is not None:
pos = map(lambda position:
{'x': position[0]*scale, 'y': position[1]*scale},
layout.values())

nodes = g.nodes()
if isinstance(g, nx.MultiDiGraph) or isinstance(g, nx.MultiGraph):
    edges = g.edges(data=True, keys=True)
    edge_builder = __build_multi_edge
else:
    edges = g.edges(data=True)
    edge_builder = __build_edge

# Map network table data
cygraph[DATA] = __map_table_data(g.graph.keys(), g.graph)

for i, node_id in enumerate(nodes):
    new_node = __create_node(g.node[node_id], node_id)
    if layout is not None:
        new_node['position'] = pos[i]

`

@shfong
Copy link

shfong commented Sep 11, 2018

I second a from_networkx function. This would make py2cytoscape much more usable for a lot of python users who already use networkx for the main data structure. (Also needs to bundle node and edge attributes!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants