title: Why doesn't the Java Collections API include a Graph implementation?
body: <p>I’m currently learning the Java Collections API and feel I have a good understanding of the basics, but I’ve never understood why this standard API doesn’t include a Graph implementation.  The three base classes are easily understandable (List, Set, and Map) and all their implementations in the API are mostly straightforward and consistent.</p>
  
  <p>Considering how often graphs come up as a potential way to model a given problem, this just doesn’t make sense to me (it’s possible it does exist in the API and I’m not looking in the right place of course).  Steve Yegge suggests in one of his blog posts that a programmer should consider graphs first when attacking a problem, and if the problem domain doesn’t fit naturally into this data structure, only then consider the alternative structures. </p>
  
  <p>My first guess is that there is no universal way to represent graphs, or that their interfaces may not be generic enough for an API implementation to be useful?  But if you strip down a graph to its basic components (vertices and a set of edges that connect some or all of the vertices) and consider the ways that graphs are commonly constructed (methods like addVertex(v) and insertEdge(v1, v2))  it seems that a generic Graph implementation would be possible and useful.  </p>
  
  <p>Thanks for helping me understand this better.</p>