code stringlengths 3 1.18M | language stringclasses 1
value |
|---|---|
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
/*
* Copyright (C) 2011 Google Inc.
*
* 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 ... | Java |
package math;
public class Complex {
private double real;
private double imag;
public Complex(double real, double imag) {
this.real = real;
this.imag = imag;
}
public String toString() {
if(imag<0) {
return new String(real+" - i"+Math.abs(imag));
} else {
return new String(real... | Java |
package math;
public class DFT {
public static final int RECTANGULAR = 0;
public static final int HANN = 1;
public static final int HAMMING = 2;
public static final int BLACKMANN = 3;
public static final double[] forwardMagnitude(double[] input) {
int N = input.length;
double[] mag = new double... | Java |
package math;
public class Tools {
public static final double TWO_PI = 2*Math.PI;
public static final double LOG_OF_2_BASE_10 = 1/Math.log10(2);
public static double log2(double x) {
return Math.log10(x)/Math.log10(2.0);
}
public static final double[] lowpass(double[] signal, int nPoints) {
... | Java |
package math;
/*
* http://www.cs.princeton.edu/introcs/97data/FFT.java.html
* Should be optimized. w_n may be looked up from a table etc.
*
* Java DSP book
*/
public class FFT {
// private static int length;
private static double[] r_data = null;
private static double[] i_data = null;
privat... | Java |
package wpam.recognizer;
public class Spectrum {
private double[] spectrum;
private int length;
public Spectrum(double[] spectrum)
{
this.spectrum = spectrum;
this.length = spectrum.length;
}
public void normalize()
{
double maxValue = 0.0;
for(int i=0;i<length; ++i)
if(max... | Java |
package wpam.recognizer;
public class Tone {
private int lowFrequency;
private int highFrequency;
private char key;
private static int FREQUENCY_DELTA = 2;
public Tone(int lowFrequency, int highFrequency, char key)
{
this.lowFrequency = lowFrequency;
this.highFrequency = highFrequency;... | Java |
package wpam.recognizer;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import android.content.Context;
import android.util.Log;
pub... | Java |
package wpam.recognizer;
import java.util.ArrayList;
import java.util.Collection;
public class StatelessRecognizer {
private Spectrum spectrum;
private Collection<Tone> tones;
public StatelessRecognizer(Spectrum spectrum)
{
this.spectrum = spectrum;
tones = new ArrayList<Tone>();
fi... | Java |
package wpam.recognizer;
import java.util.ArrayList;
public class Recognizer
{
ArrayList<Character> history;
char acctualVaue;
public Recognizer()
{
clear();
}
private void clear()
{
history = new ArrayList<Character>();
acctualVaue = ' ';
}
public char getRecognizedKey(char ... | Java |
package wpam.recognizer;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class HistoryItem implements Serializable
{
String dataTime;
String text;
public HistoryItem(final String text)
{
this.text = text;
this.dataTime = now();
}
privat... | Java |
package wpam.recognizer;
import java.util.concurrent.BlockingQueue;
import math.FFT;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.os.AsyncTask;
public class RecordTask extends AsyncTask<Void, Object, Void> {
int frequency = 16000;
int channelConfiguration = Au... | Java |
package wpam.recognizer;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.widget.ImageView;
public class SpectrumView
{
ImageView imageView;
Bitmap bitmap;
Canvas canvas;
Paint paint;
public void setI... | Java |
package wpam.recognizer;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class HistoryRowAdapter extends ArrayAdapter<HistoryItem> {
private History his... | Java |
package wpam.recognizer;
import java.util.HashMap;
import java.util.Map;
import android.widget.Button;
public class NumericKeyboard
{
private Map<Character, Button> buttons;
public NumericKeyboard()
{
buttons = new HashMap<Character, Button>();
}
public void add(char c, Button button)
... | Java |
package wpam.recognizer;
import math.FFT;
public class DataBlock
{
private double[] block;
public DataBlock(short[] buffer, int blockSize, int bufferReadSize)
{
block = new double[blockSize];
for (int i = 0; i < blockSize && i < bufferReadSize; i++) {
block[i] = (double) buffer[i];
}
... | Java |
package wpam.recognizer;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class Controller
{
private boolean started;
private RecordTask recordTask;
private RecognizerTask recognizerTask;
private MainActivity mainActivity;
BlockingQueue<DataBlo... | Java |
package wpam.recognizer;
import pl.polidea.apphance.Apphance;
import android.R.string;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.P... | Java |
package wpam.recognizer;
import android.app.ListActivity;
import android.os.Bundle;
public class HistoryActivity extends ListActivity
{
private HistoryRowAdapter historyRowAdapter;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setC... | Java |
package wpam.recognizer;
import java.util.concurrent.BlockingQueue;
import android.os.AsyncTask;
public class RecognizerTask extends AsyncTask<Void, Object, Void> {
private Controller controller;
private BlockingQueue<DataBlock> blockingQueue;
private Recognizer recognizer;
public RecognizerT... | Java |
package annas.misc;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import annas.graph.EdgeInterface;
import annas.graph.WeightedEdgeInterface;
public class GraphPath<V, E extends EdgeInterface<V>> {
private Set<E> edges;
public GraphPath() {
super();
this.edges = new LinkedH... | Java |
package annas.misc;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Iterator;
import annas.graph.GraphInterface;
import annas.graph.IntegerEdge;
public class Graph6FileReader implements Iterable<GraphInterface<Integer,Intege... | Java |
package annas.misc;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Iterator;
import annas.graph.GraphInterface;
import annas.graph.IntegerEdge;
import annas.graph.UndirectedGraph;
import annas.math.Matrix;
public class GraphIterator implements Iterator<GraphInterfa... | Java |
package annas.misc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
/**
* This class provides a means of persistence, providing the ability to
* push/pull a graph to a SQL (Sqlite) database.
*
*
* @see java.s... | Java |
package annas.misc;
import java.util.Arrays;
import annas.graph.GraphInterface;
import annas.graph.IntegerEdge;
import annas.graph.SimpleUndirectedGraph;
import annas.graph.util.Utilities;
import annas.math.Matrix;
/**
* Encodes and decodes graphs in graph6 format.
*
* @author Sam Wilson
* @version v1.0
*/
pub... | Java |
package annas.misc;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.Prep... | Java |
package annas.graph;
@SuppressWarnings("serial")
public class SimpleDirectedGraph<V, E extends EdgeInterface<V>> extends
DirectedGraph<V, E> {
public SimpleDirectedGraph(Class<? extends E> edgeClass) {
super(edgeClass);
this.allowloops = false;
this.allowparallelEdges = false;
}
public SimpleDirectedGraph... | Java |
package annas.graph;
import annas.util.EqualityChecker;
public class UndirectedEdgeEqualityChecker<V, E extends EdgeInterface<V>>
implements EqualityChecker<E> {
@SuppressWarnings("unchecked")
@Override
public boolean check(Object a, Object b) {
E e1 = (E) a;
E e2 = (E) b;
boolean oneway = e1.getHead().e... | Java |
/**
*
*/
package annas.graph;
/**
* Base class for all weighted graphs using the default implementation.
*
* @author Sam
*
*/
@SuppressWarnings("serial")
public abstract class AbstractWeightedGraph<V, E extends EdgeInterface<V>>
implements GraphInterface<V, E> {
}
| Java |
package annas.graph.isomorphism.precondition;
import annas.graph.GraphInterface;
public interface Precondition {
public boolean evaluate(GraphInterface<?, ?> g1, GraphInterface<?, ?> g2);
}
| Java |
package annas.graph.isomorphism.precondition;
import annas.graph.GraphInterface;
/**
* Checks if the size of two graphs is equal.
*
* @author Sam Wilson
*/
public class SizePrecondition implements Precondition {
@Override
public boolean evaluate(GraphInterface<?, ?> g1, GraphInterface<?, ?> g2) {
return g1... | Java |
package annas.graph.isomorphism.precondition;
import annas.graph.GraphInterface;
/**
* Checks if the order of two graphs is equal.
*
* @author Sam Wilson
*/
public class OrderPrecondition implements Precondition {
@Override
public boolean evaluate(GraphInterface<?, ?> g1, GraphInterface<?, ?> g2) {
return g... | Java |
package annas.graph.isomorphism;
import java.util.Iterator;
import java.util.List;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
public class IsomorphicInducedSubgraphGenerator<V, E extends EdgeInterface<V>>
implements Iterable<List<V>> {
private GraphInterface<V, E> target;
private Grap... | Java |
package annas.graph.isomorphism;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.util.InducedSubgraph;
import annas.math.combinatorics.PermutationGenerator;
/**
*
* @author Sam Wilson
*
*/
pu... | Java |
package annas.graph.isomorphism;
import java.util.Iterator;
import java.util.List;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.math.combinatorics.SimpleCombinationGenerator;
public class IsomorphicInducedSubgraphIterator<V, E extends EdgeInterface<V>>
implements Iterator<List<... | Java |
/**
*
*/
package annas.graph.isomorphism;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.isomorphism.precondition.Precondition;
/**
* @author Sam Wilson
*
*/
public abstract class GraphIsomorphism... | Java |
package annas.graph;
import java.io.Serializable;
/**
* Factory used to construct edge.
*
* @author Sam
*
* @param <V>
* Vertex type
* @param <E>
* Edge type
*/
public interface EdgeFactory<V, E extends EdgeInterface<V>> extends
Serializable {
/**
* Construct a new edge.
*
... | Java |
package annas.graph;
import java.io.Serializable;
import java.util.Collection;
import java.util.Set;
/**
* Base interface for all Graphs
*
* @author Sam Wilson
*
* @param <V>
* Vertex type
* @param <E>
* Edge type
*/
public interface GraphInterface<V, E extends EdgeInterface<V>> exten... | Java |
package annas.graph;
/**
* Factory for creating vertices
*
* @author Sam Wilson
*
* @param <V>
* Vertex type
*/
public interface VertexFactory<V> {
public V createVertex();
}
| Java |
package annas.graph;
@SuppressWarnings("serial")
public class ClassEdgeFactory<V, E extends EdgeInterface<V>> implements
EdgeFactory<V, E> {
private Class<? extends E> edgeClass;
public ClassEdgeFactory(Class<? extends E> edgeClass) {
this.edgeClass = edgeClass;
}
@Override
public E create(V source, V targ... | Java |
package annas.graph;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.uti... | Java |
package annas.graph;
@SuppressWarnings("serial")
public class DefaultWeightedEdge<V> implements WeightedEdgeInterface<V> {
private V head;
private V tail;
private double weight;
public DefaultWeightedEdge() {
super();
}
@Override
public String toString() {
return this.tail + "-[" +this.weight + "]->"+ ... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* See Graph classes for description of class <a
* href="http://www.graphclasses.org/smallgraphs.html#families_XF">Graph
* classes</a>
*
* @author Sam
*... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
/**
* See Graph classes for description of class <a
* href="http://www.graphclasses.org/smallgraphs.html#families_XF">Graph
* classes</a>
*
* @author Sam
*
* @param <N>
* @param <A>
*/
... | Java |
package annas.graph.generate;
import annas.graph.VertexFactory;
public class DefaultVertexFactory implements VertexFactory<Integer> {
private int count;
public DefaultVertexFactory() {
super();
this.count = -1;
}
@Override
public Integer createVertex() {
this.count++;
return Integer.valueOf(count);
}... | Java |
package annas.graph.generate;
import java.util.ArrayList;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a Hyper Graph @see <a
* href="http://mathworld.wolfram.com/Hypergraph.html"> shown here</a>
*
* @author Sam Wilso... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
public interface GraphGenerator<V, E extends EdgeInterface<V>> {
public void generateGraph(GraphInterface<V, E> graph,
VertexFactory<V> vertexFactory, Map<St... | Java |
package annas.graph.generate;
import java.util.ArrayList;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a graph with n vertices which are cyclically order where each
* vertex is adjacent to a set of vertices specified as... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates an empty Graph @see <a
* href="http://mathworld.wolfram.com/EmptyGraph.html"> shown here</a>
*
* @author Sam Wilson
*
* @param <V>
* ... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a linear Graph, a straight line graph
*
* @author Sam Wilson
*
* @param <V>
* Vertex type
* @param <E>
* Edge type... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a Star Graph @see <a
* href="http://mathworld.wolfram.com/StarGraph.html"> shown here</a>
*
* @author Sam Wilson
*
* @param <V>
* ... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a Wheel Graph @see <a
* href="http://mathworld.wolfram.com/WheelGraph.html"> shown here</a>
*
* @author Sam Wilson
*
* @param <V>
* ... | Java |
package annas.graph.generate;
import java.util.Map;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.VertexFactory;
/**
* Generates a Complete Graph @see <a
* href="http://mathworld.wolfram.com/CompleteGraph.html"> shown here</a>
*
* @author Sam Wilson
*
* @param <V>
*... | Java |
package annas.graph.generate;
import java.util.Collection;
import java.util.Map;
import java.util.Random;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.SimpleDirectedGraph;
import annas.graph.SimpleUndirectedGraph;
import annas.graph.VertexFactory;
public class RandomGraph<V... | Java |
package annas.graph;
@SuppressWarnings("serial")
public class DefaultEdge implements EdgeInterface<String> {
private String head;
private String tail;
public DefaultEdge() {
super();
}
@Override
public String toString() {
return this.tail + "->" + this.head;
}
@Override
public String getHead() {
re... | Java |
package annas.graph;
public class GraphFactory {
public static <V, E extends EdgeInterface<V>,C extends GraphInterface<V,E>> C getGraphByClass(Class<C> c) {
try {
return c.newInstance();
} catch (Exception ex) {
throw new RuntimeException("Cant get new instance of graph type", ex);
}
}
}
| Java |
package annas.graph;
import java.util.Set;
/**
* @author Sam
*
*/
@SuppressWarnings("serial")
public class UndirectedGraph<V, E extends EdgeInterface<V>> extends
AbstractGraph<V, E> {
public UndirectedGraph(EdgeFactory<V, E> edgeFactory) {
super(edgeFactory, false);
this.checker = new UndirectedEdgeEquali... | Java |
package annas.graph;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
import annas.util.ArraySet;
import annas.util.EqualityChecker;
/**
* Base class for all graphs using the default implementation.
*
* ... | Java |
/**
*
*/
package annas.graph.observable;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.GraphObserver;
/**
* Provides a way for observing a graph.
*
* @author scsswi
*/
public class ObservableGraph<V, E ... | Java |
package annas.graph.observable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* This class provides a mechanism for intercepting called on a graph.
*
*
* @author scsswi
*/
public abstract class DynamicProxy implements Invoca... | Java |
/**
*
*/
package annas.graph;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
import annas.util.ArraySet;
/**
* @author Sam
*
*/
@SuppressWarnings("serial")
public class DirectedGraph<V, E extends EdgeInterface<V>> extends
AbstractGraph<V, E> {
public DirectedGraph(EdgeFact... | Java |
package annas.graph;
import annas.util.EqualityChecker;
public class DirectedEdgeEqualityChecker<V, E extends EdgeInterface<V>>
implements EqualityChecker<E> {
@SuppressWarnings("unchecked")
@Override
public boolean check(Object a, Object b) {
E e1 = (E) a;
E e2 = (E) b;
boolean oneway = e1.getHead().equ... | Java |
package annas.graph;
public interface WeightedEdgeInterface<V> extends EdgeInterface<V> {
public double getWeight();
public void setWeight(double weight);
}
| Java |
package annas.graph;
import java.util.Collection;
import java.util.Set;
@SuppressWarnings("serial")
public class UnmodifiableGraph<V, E extends EdgeInterface<V>> implements
GraphInterface<V, E> {
private GraphInterface<V, E> graph;
private final String err_msg = "Method not supported on Unmodifiable graph";
p... | Java |
package annas.graph;
import java.io.Serializable;
/**
* Any class wishing to observer a graph must implement this interface
*
* @author Sam Wilson
*/
public interface GraphObserver<V,E extends EdgeInterface<V>> extends Serializable {
/**
* Method called when an edge is added to the graph being ob... | Java |
package annas.graph.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
/**
*
* Tarjan's Algorithm (named for its discoverer, Robert Tarjan) is a graph
* ... | Java |
package annas.graph.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.UndirectedGraph;
import annas.math.combinatorics.PowersetIterator;
public class InducedSubgraph {
/*... | Java |
package annas.graph.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import annas.graph.DirectedGraph;
import annas.graph.WeightedEdgeInterface;
public class FordFulkerson<V, E extends WeightedEdgeInterface<V>> {
/**
* Holds the flow
*/
pri... | Java |
package annas.graph.util;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
public interface MinimumSpanningTree<V, E extends EdgeInterface<V>> {
public GraphInterface<V,E> execute();
public double getCost();
}
| Java |
package annas.graph.util;
import java.util.ArrayList;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.WeightedEdgeInterface;
import annas.misc.GraphPath;
/**
* Determines all pair shortest paths, as described <a
* href="http://mathworld.wolfram.com/Floyd-WarshallAlgorithm.ht... | Java |
/*******************************************************************************
* Copyright (c) 2013 scsswi.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://ww... | Java |
package annas.graph.util.traverse;
import java.util.Iterator;
import annas.graph.EdgeInterface;
/**
* Interface for traversal algorithms.
*
* @author Sam Wilson
*
* @param <V>
* @param <E>
*/
public interface Traversal<V, E extends EdgeInterface<V>> extends Iterable<V> {
/**
* Get an iterator containing... | Java |
package annas.graph.util.traverse;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
import annas.graph.GraphInterface;
import annas.graph.util.Utilities;
public class NewDepthFirst<V> impl... | Java |
package annas.graph.util.traverse;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
import annas.graph.GraphInterface;
import annas.graph.util.Utilities;
public class NewBreadthFirst<V> im... | Java |
package annas.graph.util.traverse;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
public class LexBFS<V, E extends EdgeInterface<V>> implements Traversal<V, E> {
private GraphInterface<V, E> graph;
private List<V>... | Java |
package annas.graph.util.traverse;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
/**
* Performs a depth first traversal
*
* @author Sam Wilson
* @see annas.graph.util.traverse.Traversal
* @param <... | Java |
package annas.graph.util.traverse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
/**
* Performs a Breadth first traversal
*
* @author Sam Wilson
*... | Java |
package annas.graph.util.filter;
public interface FilterPredicate<T> {
public boolean evaluate(T object);
}
| Java |
package annas.graph.util.filter;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
public interface Filter<V, E extends EdgeInterface<V>> {
public GraphInterface<V, E> filter(GraphInterface<V, E> graph);
}
| Java |
package annas.graph.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import annas.graph.DefaultWeightedEdge;
import annas.graph.DirectedGraph;
import annas.graph.EdgeInterface;
import annas.graph.UndirectedGraph;
import annas.graph.WeightedEdgeInterface;
import ... | Java |
package annas.graph.util;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
/**
* All algorithms that operate on directed graphs should extend this class.
*
* @author scsswi
*
* @param <V>
* Vertex type
* @param <E>
* Edge type
*/
public class DirectedGraphAlgorithm... | Java |
package annas.graph.util;
import java.util.Comparator;
import java.util.PriorityQueue;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.UndirectedGraph;
import annas.graph.WeightedEdgeInterface;
import annas.util.DisjointSet;
public class Kruskal<V, E extends EdgeInterface<V>> ... | Java |
package annas.graph.util.certifying;
public abstract class CertifyingAlgorithm {
public abstract void compute();
public abstract boolean verify();
}
| Java |
package annas.graph.util.certifying;
public interface Verifier<I, O, C extends Certificate> {
public boolean check(I input, O output, C certificate);
}
| Java |
package annas.graph.util.certifying;
public interface Certificate {
}
| Java |
package annas.graph.util;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.misc.GraphPath;
public interface SingleSourceShortestPath<V, E extends EdgeInterface<V>> {
public GraphInterface<V, E> execute(V v);
public GraphPath<V, E> execute(V v, V u);
}
| Java |
/*******************************************************************************
* Copyright (c) 2013 scsswi.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://ww... | Java |
package annas.graph.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Map;
import java.util.PriorityQueue;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.WeightedEdgeInterface;
import annas.misc.GraphPath;
public clas... | Java |
package annas.graph.util;
public interface Matching {
}
| Java |
package annas.graph.util;
import java.util.Comparator;
import java.util.PriorityQueue;
import annas.graph.EdgeInterface;
import annas.graph.GraphInterface;
import annas.graph.UndirectedGraph;
import annas.graph.WeightedEdgeInterface;
public class Prim<V, E extends EdgeInterface<V>> implements
MinimumSpanningTree<V... | Java |
package annas.graph.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.Stack;
import annas.graph.AbstractGraph;
import annas.graph.DirectedGraph;
import annas.... | Java |
package annas.graph;
@SuppressWarnings("serial")
public class IntegerEdge implements EdgeInterface<Integer> {
private Integer head;
private Integer tail;
public IntegerEdge() {
super();
}
@Override
public String toString() {
return this.tail + "->" + this.head;
}
@Override
public Integer getHead() {... | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.