示例#1
0
 internal static void igraph_vs_destroy(ref igraph_vs_t vs)
 {
     if (X86)
     {
         igraph_vs_destroy_x86(ref vs);
     }
     else
     {
         igraph_vs_destroy_x64(ref vs);
     }
 }
示例#2
0
        internal static int igraph_pagerank(igraph_t graph, igraph_pagerank_algo_t algo, igraph_vector_t vector, out double value, igraph_vs_t vids, bool directed, double damping, igraph_vector_t weights)
        {
            value = 1;
            var options = IntPtr.Zero;

            if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_ARPACK)
            {
                var arpackoptions = GetDefaultArpackOptions();
                options = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(igraph_arpack_options_t)));
                Marshal.StructureToPtr(arpackoptions, options, false);
            }
            else if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_POWER)
            {
                var poweroptions = GetDefaultPowerOptions();
                options = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(igraph_pagerank_power_options_t)));
                Marshal.StructureToPtr(poweroptions, options, false);
            }
            try {
                return(X86 ? igraph_pagerank_x86(graph, algo, vector, ref value, vids, directed, damping, weights, options) : igraph_pagerank_x64(graph, algo, vector, ref value, vids, directed, damping, weights, options));
            } finally {
                if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_ARPACK)
                {
                    Marshal.DestroyStructure(options, typeof(igraph_arpack_options_t));
                    Marshal.FreeHGlobal(options);
                }
                else if (algo == igraph_pagerank_algo_t.IGRAPH_PAGERANK_ALGO_POWER)
                {
                    Marshal.DestroyStructure(options, typeof(igraph_pagerank_power_options_t));
                    Marshal.FreeHGlobal(options);
                }
            }
        }
示例#3
0
 private static extern void igraph_vs_destroy_x64([In, Out] ref igraph_vs_t vs);
示例#4
0
 private static extern int igraph_vs_all_x64([In, Out] ref igraph_vs_t vs);
示例#5
0
 internal static int igraph_vs_all(ref igraph_vs_t vs)
 {
     return(X86 ? igraph_vs_all_x86(ref vs) : igraph_vs_all_x64(ref vs));
 }
示例#6
0
 private static extern int igraph_pagerank_x64(igraph_t graph, igraph_pagerank_algo_t algo, [In, Out] igraph_vector_t vector, ref double value, igraph_vs_t vids, bool directed, double damping, igraph_vector_t weights, IntPtr options);