This MATLAB/C++ code for exact and approximate computation of mean first passage times (MFPT) from/to a subset of nodes/states was written circa 2017-2018 by Victor Amelkin (victor@cs.ucsb.edu, vctr@seas.upenn.edu) for the KDD'19 paper (recommended to read if you are curious about how MFPTs are computed and why so):

Victor Amelkin and Ambuj K. Singh. 2019. Fighting Opinion Control in Social Networks via Link Recommendation. In Proc. of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD '19). https://doi.org/10.1145/3292500.3330960 (pdf: https://dl.acm.org/doi/pdf/10.1145/3292500.3330960)

Please, feel free to reuse this code for educational or research purposes. If you do, please cite the originating paper:

@inproceedings{diver,
	author = {Amelkin, Victor and Singh, Ambuj K.},
	title = {Fighting Opinion Control in Social Networks via Link Recommendation},
	year = {2019},
	doi = {10.1145/3292500.3330960},
	booktitle = {Proc. of the 25th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
	pages = {677–685},
	location = {Anchorage, AK, US}
}
