Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to graphar-cli
  • Loading branch information
jasinliu committed Oct 18, 2024
2 parents 54ad924 + dd0fff6 commit 775e559
Show file tree
Hide file tree
Showing 28 changed files with 990 additions and 686 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,10 @@ jobs:
export ASAN_OPTIONS=detect_leaks=0
export ASAN_OPTIONS=detect_container_overflow=0
ctest --output-on-failure
popd
popd
- name: Upload libgraphar.a artifact
uses: actions/upload-artifact@v3
with:
name: libgraphar
path: cpp/build-static/libgraphar.a
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ width="700" alt="property graph" />

#### Logical table of vertices

Each type of vertices (with the same label) constructs a logical vertex
Each type of vertices (with the same type) constructs a logical vertex
table, with each vertex assigned with a global index inside this type
(called internal vertex id) starting from 0, corresponding to the row
number of the vertex in the logical vertex table. An example layout for
a logical table of vertices under the label "person" is provided for
a logical table of vertices under the type "person" is provided for
reference.

Given an internal vertex id and the vertex label, a vertex is uniquely
Given an internal vertex id and the vertex type, a vertex is uniquely
identifiable and its respective properties can be accessed from this
table. The internal vertex id is further used to identify the source and
destination vertices when maintaining the topology of the graph.
Expand All @@ -101,7 +101,7 @@ width="650" alt="vertex logical table" />
The logical vertex table will be partitioned into multiple continuous
vertex chunks for enhancing the reading/writing efficiency. To maintain
the ability of random access, the size of vertex chunks for the same
label is fixed. To support to access required properties avoiding
type is fixed. To support to access required properties avoiding
reading all properties from the files, and to add properties for
vertices without modifying the existing files, the columns of the
logical table will be divided into several column groups.
Expand Down Expand Up @@ -130,7 +130,7 @@ the storage.
#### Logical table of edges

For maintaining a type of edges (that with the same triplet of the
source label, edge label, and destination label), a logical edge table
source type, edge type, and destination type), a logical edge table
is established. And in order to support quickly creating a graph from
the graph storage file, the logical edge table could maintain the
topology information in a way similar to [CSR/CSC](https://en.wikipedia.org/wiki/Sparse_matrix), that is, the
Expand Down
4 changes: 1 addition & 3 deletions cpp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/build/
/build-test/
/build-test-rename/
/build*/
/examples/*/build/
/cmake-build-debug

Expand Down
4 changes: 2 additions & 2 deletions docs/libraries/cpp/examples/bgl.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ std::vector<graphar::Property> property_vector = {cc};
auto group = graphar::CreatePropertyGroup(property_vector, graphar::FileType::PARQUET);

// construct the new vertex info
std::string vertex_label = "cc_result", vertex_prefix = "result/";
std::string vertex_type = "cc_result", vertex_prefix = "result/";
int chunk_size = 100;
auto new_info = graphar::CreateVertexInfo(vertex_label, chunk_size, {group}, vertex_prefix);
auto new_info = graphar::CreateVertexInfo(vertex_type, chunk_size, {group}, vertex_prefix);

// access the vertices via the index map and vertex iterator of BGL
typedef boost::property_map<Graph, boost::vertex_index_t>::type IndexMap;
Expand Down
4 changes: 2 additions & 2 deletions docs/libraries/cpp/examples/snap-to-graphar.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ storage of the vertex information file.
auto version = graphar::InfoVersion::Parse("gar/v1").value();

// meta info
std::string vertex_label = "node", vertex_prefix = "vertex/node/";
std::string vertex_type = "node", vertex_prefix = "vertex/node/";

// create vertex info
auto vertex_info = graphar::CreateVertexInfo(
vertex_label, VERTEX_CHUNK_SIZE, {}, vertex_prefix, version);
vertex_type, VERTEX_CHUNK_SIZE, {}, vertex_prefix, version);

// save & dump vertex info
ASSERT(!vertex_info->Dump().has_error());
Expand Down
6 changes: 6 additions & 0 deletions maven-projects/info/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<proto-info.version>0.13.0.dev-SNAPSHOT</proto-info.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.graphar</groupId>
<artifactId>proto</artifactId>
<version>${proto-info.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,42 @@

package org.apache.graphar.info;

import org.apache.graphar.info.type.AdjListType;
import org.apache.graphar.info.type.FileType;
import org.apache.graphar.info.yaml.AdjacentListYaml;
import org.apache.graphar.proto.AdjListType;
import org.apache.graphar.proto.FileType;

public class AdjacentList {
private final AdjListType type;
private final FileType fileType;
private final String prefix;
private final org.apache.graphar.proto.AdjacentList protoAdjacentList;

public AdjacentList(AdjListType type, FileType fileType, String prefix) {
this.type = type;
this.fileType = fileType;
this.prefix = prefix;
protoAdjacentList =
org.apache.graphar.proto.AdjacentList.newBuilder()
.setType(type)
.setFileType(fileType)
.setPrefix(prefix)
.build();
}

AdjacentList(AdjacentListYaml yamlParser) {
this.type =
AdjListType.fromOrderedAndAlignedBy(
yamlParser.isOrdered(), yamlParser.isAligned_by());
this.fileType = FileType.valueOf(yamlParser.getFile_type());
this.prefix = yamlParser.getPrefix();
private AdjacentList(org.apache.graphar.proto.AdjacentList protoAdjacentList) {
this.protoAdjacentList = protoAdjacentList;
}

public static AdjacentList ofProto(org.apache.graphar.proto.AdjacentList protoAdjacentList) {
return new AdjacentList(protoAdjacentList);
}

public AdjListType getType() {
return type;
return protoAdjacentList.getType();
}

public FileType getFileType() {
return fileType;
return protoAdjacentList.getFileType();
}

public String getPrefix() {
return prefix;
return protoAdjacentList.getPrefix();
}

org.apache.graphar.proto.AdjacentList getProto() {
return protoAdjacentList;
}
}
Loading

0 comments on commit 775e559

Please sign in to comment.