Package stallone.api.graph

Examples of stallone.api.graph.IIntGraph


        return (true);
    }

    private void calculateComponents()
    {
        IIntGraph g = new MatrixIntGraph(T);
        IntStrongConnectivity connectivity = new IntStrongConnectivity(g);
        connectivity.perform();

        List<IIntArray> C = connectivity.getStrongComponents();
//        int[][] C = g.BFS_mult();
View Full Code Here


    {
        this.Q = _Q;
        this.A = _A;
        this.B = _B;

        IIntGraph g = graphNew.intMatrixGraph(_F);

        this.inA = new boolean[_F.rows()];
        for (int i = 0; i < A.length; i++)
            inA[A[i]] = true;
       
        inB = new boolean[_F.rows()];
        for (int i = 0; i < B.length; i++)
            inB[B[i]] = true;

        // convert double matrix into Big Decimals
        this.F = new SparseObjectMatrix2D(_F.rows(), _F.rows());
        for (int i=0; i<_F.rows(); i++)
            for (int j=0; j<_F.rows(); j++)
                if (_F.get(i,j) != 0)
                    F.set(i,j, new BigDecimal(_F.get(i,j)));

        // collect in- and outflux of every node
        this.influxes = new BigDecimal[_F.rows()];
        this.outfluxes = new BigDecimal[_F.rows()];
        for (int i=0; i<influxes.length; i++)
            {
                influxes[i] = BigDecimal.ZERO;
                outfluxes[i] = BigDecimal.ZERO;
            }

        for (int i=0; i<F.rows(); i++)
            for (int j=0; j<F.rows(); j++)
                {
                    if (F.get(i,j) != null)
                        {
                            influxes[j] = influxes[j].add((BigDecimal)F.get(i,j));
                            outfluxes[i] = outfluxes[i].add((BigDecimal)F.get(i,j));
                        }
                }

        // correct for rounding errors by iterating nodes with increasing committor.
        int[] IQ = doubleArrays.sortedIndexes(Q);
        for (int i=0; i<IQ.length; i++)
            {
                int s = IQ[i]; // this is the current node

                if (influxes[s].equals(BigDecimal.ZERO) ||
                    outfluxes[s].equals(BigDecimal.ZERO))
                    continue;

                BigDecimal err = outfluxes[s].subtract(influxes[s]); // difference between in and out

                // correct outflux.
                int[] neighbors = g.getNeighbors(s).getArray();

                int ilargest = 0;
                double flargest = _F.get(s,neighbors[0]);
                for (int j=1; j<neighbors.length; j++)
                    if (_F.get(s, neighbors[j]) > flargest)
View Full Code Here

    /**
       Checks if the current graph structure has a A->B reaction pathway
     */
    public boolean hasConnection(int[][] _E)
    {
  IIntGraph g = graphNew.intListGraph(_E);
  for (int i=0; i<A.length; i++)
      {
                int[] found = graph.bfs(g, A[i]);
    for (int j=0; j<found.length; j++)
        if (inB[found[j]])
View Full Code Here

        return (connectedComponents(P).size() == 1);
    }

    public List<IIntArray> connectedComponents(IDoubleArray P)
    {
        IIntGraph g = new MatrixIntGraph(P);
        IntStrongConnectivity connectivity = new IntStrongConnectivity(g);
        connectivity.perform();

        List<IIntArray> C = connectivity.getStrongComponents();
        return C;
View Full Code Here

TOP

Related Classes of stallone.api.graph.IIntGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.