Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:25:27+00:00 2026-05-27T13:25:27+00:00

I want every node to have a ipaddress string, latitude and longitude values. Also

  • 0

I want every node to have a ipaddress string, latitude and longitude values. Also how do I get a pointer to such object on looking up the graph created by networkx?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:25:27+00:00Added an answer on May 27, 2026 at 1:25 pm

    NetworkX is based on the idea that graphs can act like dictionaries. You don’t need a custom object to act as nodes, as the nodes can have arbitrary properties added to their “dictionaries”.

    Consider the following interactive session:

    >>> import networkx as nx
    >>> G = nx.Graph()
    >>> G.add_node(1)
    >>> G.node[1]['ipaddress'] = '8.8.8.8'
    >>> G.node[1]['longitude'] = 37
    >>> G.node[1]['latitude'] = 50
    >>> G.node[1]
    {'latitude': 50, 'ipaddress': '8.8.8.8', 'longitude': 37}
    >>> G.node[1]['ipaddress']
    '8.8.8.8'
    

    Here, a graph with a single node 1 is created, to which ipaddress, longitude, and latitude are associated. You access that node directly in constant time by asking the graph for the node, and get its properties in much the same way.

    To refer to specific nodes, you have a couple of possibilities. You could, e.g., use a dictionary to store a list or set of nodes for any desired properties. The second possibility – which is only useful for a single property that is unique to each node – is to use the property as the node directly. E.g., for IP addresses:

    >>> H = nx.Graph()
    >>> H.add_node('8.8.8.8', longitude=37, latitude=50)
    >>> H.node['8.8.8.8']
    {'latitude': 50, 'longitude': 37}
    

    Here, I’ve also taken advantage of a convenience provided by NetworkX to specify the properties as the node is created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that in OOP you want every object (from a class) to be
Let's say I have a class of 30 students and want generate every possible
I want to store every single character of a string value in every single
I have WPF treeView which has ControlTemplate which show every node of treeView consisting
I have an xml document as a string without any namespace and I want
I have a node.js script on my server that I want to run continuously
I have following POJO`s: - Company Node (nodeID, company) User (userID, node) I want
Using Javascript, I want to take the content of a string and wrap every
I want every cell in each row except the last in each row. I
I want so send every week an update by email. But Im afraid that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.