All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gr.james.simplegraph.Tree Maven / Gradle / Ivy

Go to download

Simple Graph is a graph interface for Java 6 that is designed to expose a very simple API to support working with graphs

The newest version!
package gr.james.simplegraph;

import java.util.Set;

/**
 * Represents an unweighted and undirected graph in which any two vertices are connected by exactly one path.
 * 

* This graph must contain at least one vertex. A tree cannot contain self loops or parallel edges. More formally, any * unordered pair of endpoints may correspond to at most one edge. *

* An unordered pair {@code {a, b}} is a pair of objects with no particular relation between them; the order in which * the objects appear in the pair is not significant. *

* Memory Complexity: O(V+E) */ public interface Tree extends Graph { /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override int size(); /** * Returns the number of undirected edges in this tree, that is {@code size() - 1}. *

* Complexity: O(1) * * @return the number of undirected edges in this tree */ int edgeCount(); /** * {@inheritDoc} * * @param v {@inheritDoc} * @return {@inheritDoc} * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override Set adjacent(int v); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override Iterable edges(); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override DirectedGraph asDirected(); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override WeightedGraph asWeighted(); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override WeightedDirectedGraph asWeightedDirected(); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override String toString(); /** * {@inheritDoc} * * @param obj {@inheritDoc} * @return {@inheritDoc} * @see Graphs#equals(Graph, Graph) */ @Override boolean equals(Object obj); /** * {@inheritDoc} * * @return {@inheritDoc} */ @Override int hashCode(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy