We evaluate the following basic graph tasks in the GraphQA benchmark with various graph generator algorithms and different graph encoding functions.
Graph Tasks:
node count
edge count
edge existence
node degree
connected nodes
cycle check
Graph generator algorithms include er
, sbm
, sfn
, complete
, star
, path
, and ba
.
Graph encoding functions include adjacency
, friendship
, co-authorship
, incident
, social network
, and expert
.
In this section, we describe how to generate the necessary files to run the experiments for CodeGraph and Baseline Prompting Methods.
The following command-line instructions are used to generate the files required for running CodeGraph experiments.
cd CodeGraph
./codegraph/cg_task_generator.sh
You can specify a different k-shot
value to include more exemplars by passing the desired number as an argument.
Example (2-shot):
./codegraph/cg_task_generator.sh 2
./run_parallel_cg_graph_generator_with_diff_exemplar.sh
The baseline prompting methods (Default 2-shot) are provided by GraphQA, which supports various techniques such as:
- Few-shot
- Zero-shot
- Chain of Thought (CoT)
To use these baseline methods, follow these steps:
-
Create Folders for Graph Tasks by Algorithm
cd CodeGraph
for algo in er ba sfn sbm complete star path; do mkdir -p graphqa/tasks/$algo; done
-
Edit the task_generator.sh script
Navigate to thegraphqa
folder and modify thetask_generator.sh
script. -
Update the directory paths
Ensure the following variables and their order are correctly set before running the script:# Algorithm to use. Default is 'er' (Erdos-Rényi graphs). # Other options: sbm, sfn, complete, star, path, ba ALGORITHM=${ALGORITHM:-"er"} # Directory where generated graphs are stored GRAPHS_DIR="./graphqa/graphs" # Directory where tasks corresponding to the chosen algorithm are stored TASK_DIR="./graphqa/tasks/$ALGORITHM"
-
Run the Task Generator
Make sure your current working directory isCodeGraph
. Then, run the task generator script:# Optional: Export ALGORITHM if you wish to override the default export ALGORITHM="er" # Using Erdos-Rényi graphs # Run the task generator ./graphqa/task_generator.sh