com.mxgraph.analysis.mxUnionFind Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jgraphx Show documentation
Show all versions of jgraphx Show documentation
JGraphX Swing Component - Java Graph Visualization Library
This is a binary & source redistribution of the original, unmodified JGraphX library originating from:
"http://downloads.jgraph.com/downloads/jgraphx/archive/jgraphx-2_0_0_1.zip".
The purpose of this redistribution is to make the library available to other Maven projects.
/**
* $Id: mxUnionFind.java,v 1.2 2009-11-24 12:00:28 gaudenz Exp $
* Copyright (c) 2007, Gaudenz Alder
*/
package com.mxgraph.analysis;
import java.util.Hashtable;
import java.util.Map;
/**
* Implements a union find structure that uses union by rank and path
* compression. The union by rank guarantees worst case find time of O(log N),
* while Tarjan shows that in combination with path compression (halving) the
* average time for an arbitrary sequence of m >= n operations is
* O(m*alpha(m,n)), where alpha is the inverse of the Ackermann function,
* defined as follows:
* alpha(m,n) = min{i >= 1 | A(i, floor(m/n)) > log n} for m >= n >= 1
* Which yields almost constant time for each individual operation.
*/
public class mxUnionFind
{
/**
* Maps from elements to nodes
*/
protected Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy