-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplot_lattice_bipartite_fourcycles_dependence_figures.R
67 lines (59 loc) · 2.05 KB
/
plot_lattice_bipartite_fourcycles_dependence_figures.R
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
#!/usr/bin/Rscript
##
## File: plot_lattice_bipartite_fourcycles_dependence_figures.R
## Author: Alex Stivala
## Created: June 2024
##
## Make figures illustrating dependence structure for node-centered
## four-cycles statistic.
##
## Usage: Rscript plot_lattice_bipartite_fourcycles_dependence_figures.R
##
## Writes output files:
##
## lattice_bipartite_fourcycles_dependence.pdf
## lattice_fourcycles_dependence.pdf
##
## in cwd (WARNING: overwrites).
##
## The CYPATH directory containing cypath executable and Perl scripts
## (transgrh.pl etc.) must be in the PATH as this R script uses
## system2() to call them in order to find (not just count)
## four-cycles. Have to edit the transgrh.pl script to add a
## semicolon on the end of line 38 as it does not work otherwise.
##
## For CYPATH see:
##
## http://research.nii.ac.jp/~uno/code/cypath.html
## http://research.nii.ac.jp/~uno/code/cypath11.zip
##
## Uno, T., & Satoh, H. (2014, October). An efficient algorithm for
## enumerating chordless cycles and chordless paths. In International
## Conference on Discovery Science (pp. 313-324). Springer, Cham.
##
##
library(igraph)
library(RColorBrewer)
## read in R source file from directory where this script is located
##http://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script
source_local <- function(fname){
argv <- commandArgs(trailingOnly = FALSE)
base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
source(paste(base_dir, fname, sep=.Platform$file.sep))
}
source_local('plot_fourcycles_dependence_figure.R')
###
### main
###
print(date())
print(sessionInfo())
g <- make_lattice(dim=2, length=8)
bimapping <-bipartite.mapping(g)
V(g)$type <- bimapping$type
plot_fourcycles_dependence_figure(g, 28, 36,
"lattice_bipartite_fourcycles_dependence.pdf",
21, 20)
g <- make_lattice(dim=2, length=8)
plot_fourcycles_dependence_figure(g, 28, 36,
"lattice_fourcycles_dependence.pdf",
21, 20)