Skip to content

oskaryil/independent-cascade-model

Repository files navigation

Independent Cascade Model in Go

Go

This repository contains code that implements the independent cascade model based on a temporal network.

Installation

Make sure you have Go installed (minimum version 1.15).

Running

The program is implemented and based on the formatting of the contents inside android.csv, so if you want to use another data set, please adhere to that same formatting.

Options for running the program:

Building from source

You can run the code with the command:

When running it's necessary to specify a file path to the input data file

$ go run main.go -f <relative-file-path>

To see the possible command-line flags that can be passed:

$ go run main.go --help

To build a binary: Run the following command from the root of the repository:

$ go build

Using the pre-built binary

$ ./icm -f <relative-file-path>

Example (run from the root of the repository):

$ ./icm -f ./android.csv

Running with Docker

To run with docker you can manually build the docker image using the Dockerfile or you can pull the latest docker image.

$ docker pull oskaryil/go_icm
$ docker run -it oskaryil/go_icm

Tests

Prerequisites: Go version >= v 1.15

Running tests: $ make test or $ go test ./...

Unit and integration test:

$ go test ./...

Benchmark tests

Note that these automated benchmark tests show a much higher time than when timing the code manually.

$ go test -bench=.