com.googlecode.blaisemath.graph.longitudinal.SimultaneousLayout Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blaise-graphtheory Show documentation
Show all versions of blaise-graphtheory Show documentation
Link graph definitions, algorithms, and visualization.
The newest version!
/**
* SimultaneousLayout.java
* Created Feb 6, 2011
*/
package com.googlecode.blaisemath.graph.longitudinal;
/*
* #%L
* BlaiseGraphTheory
* --
* Copyright (C) 2009 - 2016 Elisha Peterson
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.googlecode.blaisemath.annotation.InvokedFromThread;
import com.googlecode.blaisemath.graph.Graph;
import com.googlecode.blaisemath.graph.StaticGraphLayout;
import com.googlecode.blaisemath.graph.modules.layout.SpringLayout;
import java.awt.geom.Point2D;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.concurrent.ThreadSafe;
/**
* Performs layout on a longitudinal graph by connecting nodes in adjacent slices.
* @author elisha
*/
@ThreadSafe
public class SimultaneousLayout {
/** The graph's times */
private final List times;
/** Mapping of each slice of the graph to a layout */
private final List> slices = Lists.newArrayList();
// ALGORITHM PARAMETERS
//
public static class Parameters extends SpringLayout.Parameters {
/** Force per distance */
double springC = 5;
public double getTimeForce() {
return springC;
}
public void setTimeForce(double springC) {
this.springC = springC;
}
}
//
protected Parameters parameters = new Parameters();
// STATE VARIABLES
/** Stores locations of all vertices at all times, after each iteration */
final List © 2015 - 2025 Weber Informatics LLC | Privacy Policy