Converting a graph in networkx to an array of degree of nodes?
up vote
1
down vote
favorite
A beginner in this area here.
I am looking to to make a function which takes input as a graph and returns an array with degree of all nodes like
[1 2 3
4 5 2]
corresponding to 1st node having a degree of 1..?
I have made a function that returns a graph.
Now I want to use this graph and return an array.
Is there a way to convert a graph with a built in function? I tried numpy_to_matrix but that doesn't work.
python-3.x networkx
add a comment |
up vote
1
down vote
favorite
A beginner in this area here.
I am looking to to make a function which takes input as a graph and returns an array with degree of all nodes like
[1 2 3
4 5 2]
corresponding to 1st node having a degree of 1..?
I have made a function that returns a graph.
Now I want to use this graph and return an array.
Is there a way to convert a graph with a built in function? I tried numpy_to_matrix but that doesn't work.
python-3.x networkx
networkx.degree(graph)
orgraph.degree
(IIRC)
– Paul Brodersen
Nov 11 at 13:24
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
A beginner in this area here.
I am looking to to make a function which takes input as a graph and returns an array with degree of all nodes like
[1 2 3
4 5 2]
corresponding to 1st node having a degree of 1..?
I have made a function that returns a graph.
Now I want to use this graph and return an array.
Is there a way to convert a graph with a built in function? I tried numpy_to_matrix but that doesn't work.
python-3.x networkx
A beginner in this area here.
I am looking to to make a function which takes input as a graph and returns an array with degree of all nodes like
[1 2 3
4 5 2]
corresponding to 1st node having a degree of 1..?
I have made a function that returns a graph.
Now I want to use this graph and return an array.
Is there a way to convert a graph with a built in function? I tried numpy_to_matrix but that doesn't work.
python-3.x networkx
python-3.x networkx
edited Nov 12 at 0:31
asked Nov 11 at 1:34
NewYork
243
243
networkx.degree(graph)
orgraph.degree
(IIRC)
– Paul Brodersen
Nov 11 at 13:24
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35
add a comment |
networkx.degree(graph)
orgraph.degree
(IIRC)
– Paul Brodersen
Nov 11 at 13:24
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35
networkx.degree(graph)
or graph.degree
(IIRC)– Paul Brodersen
Nov 11 at 13:24
networkx.degree(graph)
or graph.degree
(IIRC)– Paul Brodersen
Nov 11 at 13:24
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245095%2fconverting-a-graph-in-networkx-to-an-array-of-degree-of-nodes%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
networkx.degree(graph)
orgraph.degree
(IIRC)– Paul Brodersen
Nov 11 at 13:24
Thanks. What does IIRC stand for?
– NewYork
Nov 12 at 0:30
If I recall correctly
– Paul Brodersen
Nov 12 at 13:35