Feature Request: Tree implementation in com.google.common.graph
See original GitHub issueI’d like to request the addition of a Tree data structure, which would be similar to a DirectedGraph
but which has a single root, disallows cycles and self-looping edges, and is fully connected.
My use case for such a feature would be to model a sequence of actions, which may branch depending on some criteria.
I’m aware that such a data structure already exists in JUNG 2 (and this is probably the solution I’ll use in the meantime), but I believe it would be something that users of the com.google.common.graph
package, in a future stable version of Guava, would appreciate.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:18 (14 by maintainers)
Top Results From Across the Web
Graphs from Features: Tree-Based Graph Layout for ... - MDPI
The proposal of a graph layout strategy for feature analysis based on circular node placement guided by similarity trees, followed by on-demand edge...
Read more >Package com.google.common.graph - Guava
An interface for graph-structured data, whose edges are anonymous entities with no identity or ... This class provides a skeletal implementation of Graph...
Read more >Overview | Protocol Buffers - Google Developers
Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible ...
Read more >Tree API - Google Groups
trees. I was thinking of writing an API for Guava to enable developers ... and then implement all the usual graph and tree...
Read more >Data Structure Visualization - Computer Science
Currently, we have visualizations for the following data structures and algorithms: Basics. Stack: Array Implementation · Stack: Linked List Implementation ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@liach It depends on which definition you use for “tree”; it’s not a settled question in graph theory.
Yes, some sources refer to trees more or less as you do (although “connected” is part of the definition), and refer to a directed graph with similar topological properties as an arborescence.
However, it seems pretty clear that what many people mean by “tree” is what you might call a “directed rooted tree”, i.e., they think of a tree as a directed (weakly) connected acyclic graph in which all edges are both directed away from [1], and reachable from, the root. E.g., “(rooted) binary tree”. In such cases people often refer to nodes of such a structure as being “leaves” or having “children”, which implies directionality.
We’ll certainly give careful thought to what terminology we use when we add capabilities like this, but ultimately we may have to use terms for which there is no strong consensus definition; that’s just the way graph theory is in my experience.
[1] A term I’ve heard for such a graph in which edges are directed towards the root is “uptree”.
@liach For my project, only 1. is true. Each and every “event” is preceded by one or zero other “events”, but each “event” leads onto potentially many other branching “events”. Therefore I believe a tree models my problem best, rather than a chain (e.g. list or iterable) or a DAG. 😃
Edit: Also, only one “event” can be preceded by zero events. This would make it the ‘root’ of my ‘tree’.