Re: How Can I make a statistics,i.e:how many vertexes or edges?


spirit...@...
 

Thanks Jason for your reply.
I'll show my code on GitHub later.
And I want to know what the HadoopMarc is? You mean Hadoop MapReduce??

在 2017年7月18日星期二 UTC+8下午10:13:53,Jason Plurad写道:

If you scroll back just a few days in the message history of this group, you'll find a link to this nice blog post: "Configuring JanusGraph for spark-yarn" https://groups.google.com/d/msg/janusgraph-users/9e82gcUTB4M/evKFnB3cAgAJ

HadoopMarc covers doing an OLAP vertex count with JanusGraph + HBase, which it sounds like what you're trying to do, and it has an example properties file.

I can't really tell what you're trying to do in that code snippet. It would be best if you would share the code publicly on GitHub or BitBucket or something similar so if somebody wanted to try it out, it would be easy to do.

> anybody online?  please help me~

JanusGraph is run by volunteers contributing to the open source project. Immediate responses may not happen. Using the mailing list and searching its archive is your best bet for learning from the community because there are several hundred folks that are subscribed to this list.


On Monday, July 17, 2017 at 11:35:47 PM UTC-4, spirit888hill wrote:
anybody online?  please help me~

在 2017年7月17日星期一 UTC+8下午5:53:32,写道:
My graph has about 100 million vertexes and 200 million edges. But if use the following code, it is too slow.
GraphTraversal<Vertex, Long> countV = traversal.V().count();
while (countV.hasNext()){
System.out.println("countV:" + countV.next());
}

GraphTraversal<Edge, Long> countE = traversal.E().count();
while (countE.hasNext()){
System.out.println("countE:" + countE.next());
}

I want to computer the count of vertex or edge directly through Hbase. The following code is:
 SnapshotCounter.HBaseGetter entryGetter = new SnapshotCounter.HBaseGetter();
       
EntryList entryList = StaticArrayEntryList.ofBytes(
                result
.getMap().get(Bytes.toBytes("e")).entrySet(),
                entryGetter
);
       
StandardTitanTx tx = (StandardTitanTx) graph.newTransaction();
       
System.out.println("Entry list size: " + entryList.size());
       
int cnt = 0;
//        IDInspector inspector = graph.getIDInspector();
        for (Entry entry : entryList) {
           
RelationCache relation = graph.getEdgeSerializer().readRelation(entry, false, tx);
//            Direction direction = graph.getEdgeSerializer().parseDirection(entry);
//            System.out.println("Direction is:" + direction.name());
//            System.out.println("relation is:" + relation);

//            System.out.println("numProperties: " + relation.numProperties());
//            Iterator<LongObjectCursor<Object>> longObjectCursorIterator = relation.propertyIterator();
//            LongObjectCursor<Object> next = longObjectCursorIterator.next();
//            System.out.println("key is:" + next.key);
//            System.out.println("value is:" + next.value);
//            System.out.println("next.toString is:" + next.toString());



            RelationType type = tx.getExistingRelationType(relation.typeId);

           
Iterator<Edge> edgeIterator1 = type.edges(Direction.BOTH);
           
while (edgeIterator1.hasNext()){
               
Edge next11 = edgeIterator1.next();
               
System.out.println("relType is :" + next11.property("relType"));
           
}

//             if (type.isEdgeLabel() && !tx.getIdInspector().isEdgeLabelId(relation.relationId)){
//            if (type.isEdgeLabel() &&  !graph.getIDManager().isEdgeLabelId(relation.relationId) &&
//                    !tx.getIdInspector().isRelationTypeId(type.longId())) {
            if (type.isEdgeLabel() ) {
                cnt
++;
               
System.out.print("isSystemRelationTypeId: ");
               
System.out.println(graph.getIDManager().isSystemRelationTypeId(relation.typeId));

               
System.out.print("isEdgeLabelId: ");
               
System.out.println(graph.getIDManager().isEdgeLabelId(relation.typeId));

               
System.out.print("type isEdgeLabel: ");
               
System.out.println(type.isEdgeLabel());

               
System.out.print("relationId isSystemRelationTypeId: ");
               
System.out.println(graph.getIDManager().isSystemRelationTypeId(relation.relationId));
               
System.out.println(entry.getValue().toString());
           
}
       
}
       
System.out.println("Edge count: " + cnt);

I made a test by making a small graph-- two vertexes and two edges.


But I just get the count of the edge is one, expecting two. Is there any problem? Please help....This problem bugs me. Thanks~~~

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.