cant access node attributesAccessing the index in 'for' loops?How to know if an object has an attribute in PythonHow to access environment variable values?Accessing nodes of networkx graph in pythonexception in I/O handler for fd3 ipython cant open ipython notebookGet keyerror accessing row by index in 16.0 Pandas dataframe in Python 3.4KeyError while accessing attributes of tags that exist - BeautifulSoupAttribute Error with Pythonescaping str format bracketsAttributeError: 'RDD' object has no attribute 'show'
If change in free energy (G) is positive, how do those reactions still occur?
A nasty indefinite integral
Why does the -OH group in β-naphthol direct the incoming diazonium salt towards the ortho position?
Ways to spot non-sentient, non-conscious, telepathic shapeshifters
How could the B-29 bomber back up under its own power?
amsmath: How can I use the equation numbering and label manually and anywhere?
Is there any mention of ghosts who live outside the Hogwarts castle?
Three knights or knaves, three different hair colors
Ribbon Cable Cross Talk - Is there a fix after the fact?
How can I reduce the size of matrix?
Nunc est bibendum: gerund or gerundive?
Is being an extrovert a necessary condition to be a manager?
csname in newenviroment
How to become an Editorial board member?
What does it mean for something to be strictly less than epsilon for an arbitrary epsilon?
Managing heat dissipation in a magic wand
Why "strap-on" boosters, and how do other people say it?
Is a world with one country feeding everyone possible?
How do I write real-world stories separate from my country of origin?
Can the Conjure Barrage spell stack with the Disarming Attack or Trip Attack Battle Master maneuvers?
Why is the Psionic Artificer considered to be better than all other tier 1 classes?
Was murdering a slave illegal in American slavery, and if so, what punishments were given for it?
If I arrive in the UK, and then head to mainland Europe, does my Schengen visa 90 day limit start when I arrived in the UK, or mainland Europe?
Existence of a model of ZFC in which the natural numbers are really the natural numbers
cant access node attributes
Accessing the index in 'for' loops?How to know if an object has an attribute in PythonHow to access environment variable values?Accessing nodes of networkx graph in pythonexception in I/O handler for fd3 ipython cant open ipython notebookGet keyerror accessing row by index in 16.0 Pandas dataframe in Python 3.4KeyError while accessing attributes of tags that exist - BeautifulSoupAttribute Error with Pythonescaping str format bracketsAttributeError: 'RDD' object has no attribute 'show'
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
g.nodes() seems to display the attributes, but otherwise I can't access them . What I'm doing wrong ?
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
[('a', 'k1': 5)]
g['a']
g['a'].keys()
[]
g['a']['k1']
KeyError Traceback (most recent call last)
<ipython-input-62-03c0859d74e1> in <module>()
----> 1 g['a']['k1']
KeyError: 'k1'
ver :1.11
upgraded to ver:2.2
g = nx.Graph()
g.add_node('b', attr_dict='k1':5)
g['b']
AtlasView()
g.nodes['b']
'attr_dict': 'k1': 5
python attributes nodes networkx
add a comment |
g.nodes() seems to display the attributes, but otherwise I can't access them . What I'm doing wrong ?
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
[('a', 'k1': 5)]
g['a']
g['a'].keys()
[]
g['a']['k1']
KeyError Traceback (most recent call last)
<ipython-input-62-03c0859d74e1> in <module>()
----> 1 g['a']['k1']
KeyError: 'k1'
ver :1.11
upgraded to ver:2.2
g = nx.Graph()
g.add_node('b', attr_dict='k1':5)
g['b']
AtlasView()
g.nodes['b']
'attr_dict': 'k1': 5
python attributes nodes networkx
add a comment |
g.nodes() seems to display the attributes, but otherwise I can't access them . What I'm doing wrong ?
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
[('a', 'k1': 5)]
g['a']
g['a'].keys()
[]
g['a']['k1']
KeyError Traceback (most recent call last)
<ipython-input-62-03c0859d74e1> in <module>()
----> 1 g['a']['k1']
KeyError: 'k1'
ver :1.11
upgraded to ver:2.2
g = nx.Graph()
g.add_node('b', attr_dict='k1':5)
g['b']
AtlasView()
g.nodes['b']
'attr_dict': 'k1': 5
python attributes nodes networkx
g.nodes() seems to display the attributes, but otherwise I can't access them . What I'm doing wrong ?
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
[('a', 'k1': 5)]
g['a']
g['a'].keys()
[]
g['a']['k1']
KeyError Traceback (most recent call last)
<ipython-input-62-03c0859d74e1> in <module>()
----> 1 g['a']['k1']
KeyError: 'k1'
ver :1.11
upgraded to ver:2.2
g = nx.Graph()
g.add_node('b', attr_dict='k1':5)
g['b']
AtlasView()
g.nodes['b']
'attr_dict': 'k1': 5
python attributes nodes networkx
python attributes nodes networkx
edited Mar 23 at 20:29
sten
asked Mar 23 at 19:43
stensten
2,18722529
2,18722529
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
For networkx 2.1 or 2.2, you can access the data regarding a specific node you must use the graph's attribute nodes. E.g.
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
print(g.nodes['a'])
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2f55317675%2fcant-access-node-attributes%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For networkx 2.1 or 2.2, you can access the data regarding a specific node you must use the graph's attribute nodes. E.g.
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
print(g.nodes['a'])
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
add a comment |
For networkx 2.1 or 2.2, you can access the data regarding a specific node you must use the graph's attribute nodes. E.g.
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
print(g.nodes['a'])
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
add a comment |
For networkx 2.1 or 2.2, you can access the data regarding a specific node you must use the graph's attribute nodes. E.g.
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
print(g.nodes['a'])
For networkx 2.1 or 2.2, you can access the data regarding a specific node you must use the graph's attribute nodes. E.g.
g = nx.Graph()
g.add_node('a', attr_dict='k1':5)
g.nodes(data=True)
print(g.nodes['a'])
edited Mar 23 at 19:58
answered Mar 23 at 19:49
Alberto BonsantoAlberto Bonsanto
10.4k63875
10.4k63875
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
add a comment |
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
print g.nodes['a']; TypeError: 'instancemethod' object has no attribute 'getitem'
– sten
Mar 23 at 19:51
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
@sten what version of networkx are you using?
– Alberto Bonsanto
Mar 23 at 19:58
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
nx.__version__ '1.11'
– sten
Mar 23 at 20:22
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
Is it mandatory to use that version? Apparently it's very easy in newer versions
– Alberto Bonsanto
Mar 23 at 20:40
upgraded to new ver
– sten
Mar 23 at 20:42
upgraded to new ver
– sten
Mar 23 at 20:42
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f55317675%2fcant-access-node-attributes%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