Package edu.cmu.graphchi.datablocks

Examples of edu.cmu.graphchi.datablocks.FloatPair


                }
            }

            float newValue = nbrSum;

            FloatPair curValue = vertex.getValue();
            if (side == LEFTSIDE && vertex.numOutEdges() > 0) {
                curValue = new FloatPair(newValue, curValue.second);
                // Write value to outedges
                float broadcastValue = newValue / vertex.numOutEdges();
                for(int i=0; i < vertex.numOutEdges(); i++) {
                    vertex.outEdge(i).setValue(broadcastValue);
                }
View Full Code Here


        this.numShards = numShards;
        return new FastSharder<FloatPair, Float>(graphName, numShards, new VertexProcessor<FloatPair>() {
            @Override
            /* For lists (hubs), the vertex value will encode the total number of edges */
            public FloatPair receiveVertexValue(int vertexId, String token) {
                return new FloatPair(0.0f, Float.parseFloat(token));
            }
        }, new EdgeProcessor<Float>() {
            @Override
            public Float receiveEdge(int from, int to, String token) {
                return Float.parseFloat(token);
View Full Code Here

                nbrSum /= leftNorm;
            }

            float newValue = nbrSum;

            FloatPair curValue = vertex.getValue();
            if (side == LEFTSIDE && vertex.numOutEdges() > 0) {
                curValue = new FloatPair(newValue, curValue.second);
                synchronized (this) {
                    leftSideSqrSum += newValue * newValue;
                }

                // Write value to outedges
View Full Code Here


                leftNorm = (float) Math.sqrt(leftSideSqrSum);
                VertexTransformer.transform((int) ctx.getNumVertices(), graphName, new FloatPairConverter(), new VertexTransformCallBack<FloatPair>() {
                    public FloatPair map(int vertexId, FloatPair value) {
                        return new FloatPair(value.first/leftNorm, value.second);
                    }
                });

                leftSideSqrSum = 0.0;
            } catch (IOException ioe) {
View Full Code Here

    protected FastSharder createSharder(String graphName, int numShards) throws IOException {
        this.numShards = numShards;
        return new FastSharder<FloatPair, Float>(graphName, numShards, new VertexProcessor<FloatPair>() {
            /* For lists (hubs), the vertex value will encode the total number of edges */
            public FloatPair receiveVertexValue(int vertexId, String token) {
                return new FloatPair(0.0f, Float.parseFloat(token));
            }
        }, new EdgeProcessor<Float>() {
            public Float receiveEdge(int from, int to, String token) {
                return Float.parseFloat(token);
            }
View Full Code Here

            edgeWeightSum += vertex.outEdge(i).getValue().first;
        }

        /* Write my value (divided by my out-degree) to my out-edges so neighbors can read it. */
        for(int i=0; i<vertex.numOutEdges(); i++) {
            FloatPair curValue = vertex.outEdge(i).getValue();
            float edgeWeight = vertex.outEdge(i).getValue().first;
            vertex.outEdge(i).setValue(new FloatPair(curValue.first, vertex.getValue() * edgeWeight/edgeWeightSum));
        }

    }
View Full Code Here

            public Float receiveVertexValue(int vertexId, String token) {
                return (token == null ? 0.f : Float.parseFloat(token));
            }
        }, new EdgeProcessor<FloatPair>() {
            public FloatPair receiveEdge(int from, int to, String token) {
                return new FloatPair(Float.parseFloat(token), 0.f);
            }
        }, new FloatConverter(), new FloatPairConverter());
    }
View Full Code Here

            edgeWeightSum += vertex.outEdge(i).getValue().first;
        }

        /* Write my value (divided by my out-degree) to my out-edges so neighbors can read it. */
        for(int i=0; i<vertex.numOutEdges(); i++) {
            FloatPair curValue = vertex.outEdge(i).getValue();
            float edgeWeight = vertex.outEdge(i).getValue().first;
            vertex.outEdge(i).setValue(new FloatPair(edgeWeight, vertex.getValue() * edgeWeight/edgeWeightSum));
        }

    }
View Full Code Here

            public Float receiveVertexValue(int vertexId, String token) {
                return (token == null ? 0.0f : Float.parseFloat(token));
            }
        }, new EdgeProcessor<FloatPair>() {
            public FloatPair receiveEdge(int from, int to, String token) {
                return new FloatPair(Float.parseFloat(token), 0.f);
            }
        }, new FloatConverter(), new FloatPairConverter());
    }
View Full Code Here

TOP

Related Classes of edu.cmu.graphchi.datablocks.FloatPair

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.