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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:53:29+00:00 2026-05-26T09:53:29+00:00

I am looking for a good Java Graph Library which is thread safe for

  • 0

I am looking for a good Java Graph Library which is thread safe for concurrent access.
JGraphT, JUNG, JTS are very good but again for concurrent access I will have to synchronize it externally which is becoming a pain.
It is a pain because say If thread A have to access 50 vertices, Thread B for another 50 with the intersection of vertices being 20 vertices. Now while writing code I need to know this 20 before so that I can synchronize it accordingly.
Pl suggest

  • 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-26T09:53:30+00:00Added an answer on May 26, 2026 at 9:53 am

    I’m afraid what you’re looking for is impossible, because thread-safety is a property of algorithms, not a property of data structures. Here’s an example:

    Let’s say your graph library has a main Graph class with a number of methods, all of which are synchronized. For example, addVertex(), removeVertex(), addEdge(), removeEdge(), etc. Let’s also say that the Vertex class has some useful methods like getAdjacentEdges(), for example, also synchronized on the containing Graph instance.

    Now clearly because everything is synchronized, it’s impossible to corrupt the data structure. For example, you’ll never have a situation where v.getAdjacentEdges() gives you an edge that’s not actually in the graph containing vertex v. The graph structure is always internally consistent thanks to its internal synchronization.

    However, your algorithms operating on the graph can still easily break. For example, let’s say you write:

    for (Edge e : v.getAdjacentEdges()) {
      g.removeEdge(e);
    }
    

    The call to getAdjacentEdges() is atomic, as is each call to removeEdge() in the loop, but the algorithm itself is not. Another thread may add a new edge adjacent to v while this loop is running, or remove an edge, or whatever. To be safe, you still need a way of ensuring that the loop as a whole is atomic, and the graph itself cannot provide that.

    My best advice, I think, is to use JGraphT in combination with Akka’s STM implementation (or similar), so that you can write your algorithms without needing to determine ahead of time which objects will require locking. If you’re not familiar with STM and its performance characteristics, Wikipedia’s article on the topic does a decent job of explaining.

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

Sidebar

Related Questions

I'm looking for a good charting library for Java. It can be open source
I am looking for a good visualization library in Java for my school project
I have been looking for a good Java web framework and found Tapestry, which
I'm looking for a good Java obfuscator. I've done initial research into the following
Is there a good Java alternative to pyftpdlib? I am looking for an easy
I'm looking for a good easy to use Java based Quadratic Programming (QP) solver.
I'm looking for a good sorted list for java. Googling around give me some
I'm looking for a good tool to profile a java webapp. I'd like to
I am looking into building a smallish Java rpg. I haven't found any good
I’m currently looking for a Java Swing all-in-one professional component pack to create good-looking

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.