hiragana = "あいうえおかきくけこさしすせそたちつてとなにぬねの"
schema.vertexLabel("Letter").ifNotExists().partitionBy("id", Text).create();
schema.edgeLabel('row').ifNotExists().from('Letter').to('Letter').create()
schema.edgeLabel('col').ifNotExists().from('Letter').to('Letter').create()
List<Vertex> arr = new ArrayList<Vertex>();
for(i=0; i<25; i++){
arr.add(g.addV("Letter").property("id", String.valueOf(hiragana.charAt(i))).next());
}
for(i=0; i<5; i++){
from = arr.get(i)
for (j=1; j<5; j++) {
to = arr.get(i + j * 5)
g.addE("col").from(from).to(to).next();
}
}
for(i=0; i<5; i++){
from = arr.get(i * 5)
for (j=1; j<5; j++) {
to = arr.get(i * 5 + j)
g.addE("row").from(from).to(to).next();
}
}
dev.V()
Last active
May 30, 2020 15:15
-
-
Save mzsima/bb6997f31f7b932400ac2d391dc923f1 to your computer and use it in GitHub Desktop.
ひらがな、あ行
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment