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;








0















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









share|improve this question






























    0















    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









    share|improve this question


























      0












      0








      0








      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









      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 20:29







      sten

















      asked Mar 23 at 19:43









      stensten

      2,18722529




      2,18722529






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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'])





          share|improve this answer

























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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'])





          share|improve this answer

























          • 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















          0














          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'])





          share|improve this answer

























          • 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













          0












          0








          0







          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'])





          share|improve this answer















          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'])






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript