forked from RoyalCaliber/vertexAPI2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraphio.h
78 lines (58 loc) · 2.42 KB
/
graphio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/******************************************************************************
Copyright 2013 SYSTAP, LLC. http://www.systap.com
Written by Erich Elsen and Vishal Vaidyanathan
of Royal Caliber, LLC
Contact us at: [email protected]
This file was taken from mpgraph v0.1 which was (partially) funded by the
DARPA XDATA program under AFRL Contract #FA8750-13-C-0002. The file has
been modified by Royal Caliber, LLC.
Copyright 2013, 2014 Royal Caliber LLC. (http://www.royal-caliber.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************/
#ifndef GRAPHIO_H__
#define GRAPHIO_H__
//Some utilities for loading graph data
#include <string>
#include <vector>
//Read in a snap format graph
int loadGraph_GraphLabSnap( const char* fname
, int &nVertices
, std::vector<int> &srcs
, std::vector<int> &dsts );
//Read in a MatrixMarket coordinate format graph
int loadGraph_MatrixMarket( const char* fname
, int &nVertices
, std::vector<int> &srcs
, std::vector<int> &dsts
, std::vector<int> *edgeValues );
//Read in a binary CSR graph (Lonestar format)
//If expand is true, converts CSR into list of edges
//to be compatible with the other loaders, otherwise
//the argument srcs will contain nVertices + 1 offsets
int loadGraph_binaryCSR(const char* fname
, int &nVertices
, std::vector<int> &srcs
, std::vector<int> &dsts
, std::vector<int> *edgeValues
, bool expand = true);
//Detects the filetype from the extension
int loadGraph( const char* fname
, int &nVertices
, std::vector<int> &srcs
, std::vector<int> &dsts
, std::vector<int> *edgeValues = 0);
//write out a lonestar format binary csr file
int writeGraph_binaryCSR(const char* fname
, int nVertices, int nEdges, const int *offsets, const int* dsts
, const int *edgeValues);
int writeGraph_mtx(const char* fname, int nVertices, int nEdges
, const int *srcs, const int *dsts, const int* edgeValues);
#endif