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 8764559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:04:00+00:00 2026-06-13T16:04:00+00:00

I have a graph representation such that each nodes contains (int id, String categoryName)

  • 0

I have a graph representation such that each nodes contains (int id, String categoryName). And it consist of approx 500,000 nodes. Right now say I would like to check if categoryName "computing" exist in the graph, would that mean I have to traverse through the whole graph like using BSF method? (correct me if I am wrong here). It is pretty slow now (takes up to about 3 minutes) to check if that categoryName exist, any advise on how can I improve the speed of searching and comparing of the String values?

  • 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-06-13T16:04:02+00:00Added an answer on June 13, 2026 at 4:04 pm

    If you have no other data – then yes, searching the graph will be needed.

    However, you can pre-process and use a Map<String,Node> (Where Node is your node class) that maps from the strings to your actual nodes, and quickly find if a certain String has a relevant node.

    You can get the node from the string by using: map.get(string)

    You can use a TreeMap (which has O(logn) seek & insertion time and is ordered), and a HashMap (which implements a hash table and has O(1) average case seek & insertion time)


    Note: this assumes no duplicates, i.e. no string has two different nodes representing it.

    If this assumption is not correct, you can use something like Guava Multimap

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

Sidebar

Related Questions

I have a graph that contains nodes (groups) composed by inner nodes and when
I have 6 graph bars with the prices. Each price number will represent its
I have a graph with n nodes as an adjacency matrix . Is it
I have a graph which contains an unknown number of disconnected subgraphs. What's a
I'm using Neo4j in a concurrent environment and I have graph that looks like
I have a graph-theoretic (which is also related to combinatorics) problem that is illustrated
I have a graph in an SSRS report that shows percentages. I achieved this
Let's say that I want to create a simple graph representation where Vertex and
I have a graph object, that I need to serialize. Nomatter which members i
I have implemented the Kruskal algorithm in C using an adjacency matrix graph representation,

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.