Complex Network View of the Sun’s Magnetic Patches. I. Identification

Solar and stellar magnetic patches (i.e., magnetic fluxes that reach the surface from the interior) are believed to be the primary sources of a star’s atmospheric conditions. Here, we apply the complex network approach and investigate its efficacy in the identification of these features. For this purpose, we use the line-of-sight magnetograms provided by the Helioseismic and Magnetic Imager on board the Solar Dynamics Observatory. We construct the magnetic network following a specific visibility graph condition between pairs of pixels with opposite polarities and search for possible links between these regions. The complex network facilitates the construction of node degrees and PageRank images, and applying the downhill algorithm to node-degree images allows for the grouping of pixels into features corresponding to one-to-one matches with magnetogram patches. This approach promisingly serves to identify the nontrivial morphological structure of the magnetic patches for small and large sizes. We observe that the changes in the features of the node-degree images effectively correspond to the cospatial magnetic patches over time. Through visual assessment, we estimate an average false-negative error rate of approximately 1% in identifying small-scale features (one or two pixels in size).


Introduction
In Sunlike stars, the magnetic field is transferred from the inner layers to the atmosphere as the buoyantly unstable field lines bundle into the convection zone, stretch and twist along the path, and finally break through the surface.Such a dynamo creates a complex magnetic environment in which new fluxes (i.e., magnetic patches) continuously appear and cancel on a star's surface (Parker 1955;Murray et al. 2006;Priest 2014;Schmieder et al. 2014;Farhang et al. 2018;Tajik et al. 2023).Accordingly, the solar photosphere is covered by magnetic features of various sizes and timescales ranging from tiny granular magnetic loops with fluxes as small as 10 16 Mx and lifetimes of a few seconds/minutes to active regions (ARs) with fluxes up to 10 23 Mx and typical lifetimes of several weeks (Zwaan 1985;Hagenaar et al. 1999;Wiehr et al. 2004;Cheung et al. 2007;Tortosa-Andreu & Moreno-Insertis 2009;Priest 2014;Archontis & Syntelis 2019).Notably, an explicit definition of magnetic features on the Sun's surface has yet to be introduced.However, the term is commonly used to refer to flux concentrations and ephemeral regions (DeForest et al. 2007).
To date, extensive research has been devoted to observing and recognizing solar magnetic patches, and various routines have been developed for this purpose.These algorithms could principally be classified into threshold, region-growing, and clustering-bases segmentation methods, as well as deep-learning algorithms (e.g., Welsch & Longcope 2003;McAteer et al. 2005;Benkhalil et al. 2006;DeForest et al. 2007;Barra et al. 2008Barra et al. , 2009;;Watson et al. 2009;Zhang et al. 2010;Harker 2012;Verbeeck et al. 2013;Bo et al. 2022).Hagenaar et al. (1999) used the curvature of the two-dimensional map of the Michelson Doppler Imager (MDI) values of B LOS at the photosphere to detect the small solar magnetic patches.The magnetic concentrations were then determined through a pixel-clumping algorithm.Parnell (2002) proposed the Magnetic Clumping Associative Tracker (MCAT) method, which identifies magnetic features of the quiet Sun by applying a threshold-based technique.MCAT uses the intensity distribution of MDI images and implements a Gaussian approach (see also Lamb & Deforest 2003).The Yet Another Feature Tracking Algorithm (YAFTA) was designed in 2002 to detect both small-and largescale magnetic patches (Welsch & Longcope 2002).Given an initial intensity threshold, YAFTA applies a gradient-based method, namely the downhill method, to extract the positive/ negative field concentrations from magnetogram images of MDI (DeForest et al. 2007).
In the mid-2000s, with the extensive development of artificial intelligence techniques, new generations of routines were developed to tackle the patch identification problem (McAteer et al. 2005;Zharkov et al. 2005).Qahwaji & Colak (2005) developed an algorithm using both the image-processing techniques (i.e., the morphological procedure, watershed transform, image enhancement routine, and region-growing method) and the machine-learning approach (i.e., the neural network) to discern the solar-disk borders in Hα images of the Sun, eliminate the limb-darkening effect, and track ARs.Barra et al. (2008) introduced the spatial possibilistic clustering algorithm that divides solar full-disk EUV images into coronal holes, ARs, and quiet regions via the fuzzy compact clustering means (FCM) and possibilistic compact clustering means (PCM) algorithms.Kestener et al. (2010) performed a waveletbased analysis on the magnetogram images to detect solar ARs and studied the multifractal characteristics of these features.Higgins et al. (2011) investigated ARs via a region-growing perspective based on the magnetic field strength.Caballero & Aranda (2014) introduced a three-step algorithm to identify magnetic patches from the EUV images of the Sun.In this method, the images are first segmented into regions with similar properties (according to their intensity histograms).Then, the segments are classified following a hierarchical procedure.Finally, the results are validated through an optimization problem.Arish et al. (2016) developed an unsupervised segmentation routine based on the Bayesian approach to distinguish between solar ARs and coronal holes in EUV images.Quan et al. (2021) employed a deep-learning algorithm to determine boundaries of the photospheric fluxes that appeared on the mid-longitudes of the solar disk between 2010 and 2017.They applied a convolutional neural network and the YOLO-V3 algorithm and compared the efficiency of these methods.
Despite all the advances made in investigating solar atmospheric patches over the past century, the true nature of their underlying mechanism has yet to be understood (Cho et al. 2007;Bellot Rubio & Orozco Suárez 2019;Farhang et al. 2019Farhang et al. , 2022)).Studying the photospheric flux concentrations and their dynamic evolution could provide new insights into the physical processes responsible for generating and transporting the solar/stellar magnetic field (DeForest et al. 2007;Kosovichev 2009).Furthermore, the detection and tracking of the surface fields might even deliver forecasting capabilities (Nóbrega-Siverio et al. 2020).Here, we apply the complex network approach and discuss using this novel perspective to recognize flux concentrations.
The complex network is a powerful tool for analyzing causeand-effect issues and studying the impact of alterations within one part of a system on the entirety.Thus, by examining the relationships between components, researchers can identify causality and predict system dynamics.This approach can be applied to various complex networks, including the human brain (Rubinov & Sporns 2010;Sporns 2011;Colombo & Weinberger 2018), financial markets (Caldarelli et al. 2004;An et al. 2018;Tang et al. 2018), ecological dynamics (Jordán & Scheuring 2004;Holland & Hastings 2008;Jopp et al. 2010), and solar studies (Daei et al. 2017;Gheibi et al. 2017;Najafi et al. 2020;Mohammadi et al. 2021;Taran et al. 2022).
The Sun is an incredibly complex system comprising interconnected parts that collaborate to produce vast amounts of energy and influence the entire solar system.Investigating the magnetic structures of the solar photosphere plays an important role in understanding the behavior of the Sun's atmospheric phenomena.The power-law behavior of these magnetic structures (Parnell 2002;Parnell et al. 2009;Javaherian et al. 2017) highlights their complex nature.
We use magnetogram images to construct a solar magnetic network and analyze its properties.We employ a graph-theory approach to connect opposite polarities.Although these connections do not accurately represent the magnetic field lines, they align with the important fact that opposite polarities are connected due to the absence of a magnetic monopole.In network theory, a graph consisting of nodes (vertices) and edges (links) serves as a mathematical representation of a network (Steinhaeuser et al. 2010;Ebert-Uphoff & Deng 2012).Here, the pixel locations serve as nodes, and links are established based on predefined criteria.The type of graph varies depending on the specific conditions (e.g., correlation based, visibility based) and the nature of connections (simple, directed, weighted).Using network analysis, we calculate the degree of nodes and important connections (PageRank).Then, we construct their relevant images.We apply the downhill algorithm to group the pixels into features in the degrees of node images.Additionally, we implement a tracking algorithm that utilizes overlapping regions and the center distance in consecutive node-degree images to track magnetic patches.We develop an identification and tracking package based on the node-degree images at a given threshold for magnetic patches.The remainder of this paper is organized as follows: We introduce the employed data set in Section 2. The details of the developed method and performed analysis are presented in Sections 3 and 4, respectively.We finally discuss the tracking algorithm and the results in Section 5.

Data
Various ground-and space-based instruments have observed solar magnetic patches over recent decades (see e.g., Miesch 2005; Bellot Rubio & Orozco Suárez 2019, and the references therein).The Solar Dynamics Observatory (SDO) mission, launched in 2010, is a well-equipped spacecraft that has provided high-quality data in recent years.The Helioseismic and Magnetic Imager (HMI) is one of the SDO's instruments.This telescope is mainly designed to study the complex evolution of the solar magnetic field and its origin in both the inner and outer layers of the Sun (Scherrer et al. 2012).
HMI provides full-disk images in the absorption line Fe I at 6173 Å, with a spatial resolution of 1″ and temporal resolution of 45 s (Schou et al. 2012).This instrument registers Dopplergram images (solar surface velocity maps), continuum filtergrams (wide-spectrum images of the shadows), and lineof-sight (LOS) and vector magnetograms (magnetic field maps of the photosphere) (Pesnell et al. 2012;DeRosa & Slater 2013) We use the HMI LOS magnetograms with the spatial sampling of 2 4 pixel −1 at 1024 × 1024 pixels with 45 s intervals.B LOS is the radial field component at the disk center but includes nonradial components away from the disk center.The survey is confined to central equatorial regions within ±60°of solar longitude and latitude to avoid the projection effect near the limbs.However, this restriction does not prevent pixels from having mixed polarities.

The Magnetic Complex Network
We aim to construct the magnetic complex network and evaluate its utility in recognizing solar photospheric patches.Application of this approach could improve our understanding of the Sun's atmospheric events and their origins.The first step to establishing a network is to introduce a proper definition for nodes and edges.We consider each pixel of the HMI image as a node, and the existence of a link between each pair of nodes is verified based on the visibility graph condition: where I i1,j1 and I i2,j2 are the unsigned magnetic intensities (absolute values of B LOS ) of any two arbitrary pixels with different polarities, and I c corresponds to the maximum absolute values of all pixels placed along the line joining the two pixels.For example, in the HMI cutout image of Figure 1, the two pixels (red asterisks in panels (a) and (b)) connect only if their magnetic intensities exceed the values of those pixels laid on the line (panel (c)).Note that the likelihood of a link must be examined only between nodes with opposite polarities (panel (d)).Hence, a physical approach to constructing a magnetic network must focus on connections between positive and negative regions.
Having constructed the network, the calculation of its parameters is required for further investigations.The nodedegree images are obtained by taking the sum of the degrees for each pixel (node) at a given magnetic threshold.The nodedegree and PageRank images have the same size as the magnetogram.In the remainder of this paper, we show how the graph theory conveniently accomplishes the identification of magnetic patches.

The Network's Properties
We first calculate the adjacency matrix that contains information on the graph's nodes (i.e., pixel locations) and edges (i.e., connectivity).Generally, for a magnetogram image of size m × n pixels, there are N = m × n nodes over which the connectivity must be checked.The size of the adjacency matrix for such a graph is N 2 .Introducing a threshold for the background field could practically decrease the execution time as it removes some of the nodes and shrinks the adjacency matrix.Empirically, thresholds higher than 12 G are appropriate (see, e.g., Shokri et al. 2022 and the references therein).
For a simple undirected and unweighted graph, the adjacency matrix is a symmetric array with elements equal to either 1 or 0. These values indicate whether or not a connection is established between nodes.However, in directed networks, the matrix's elements could adopt either positive or negative signs to represent the entry or exit of the edges into the nodes.In the case of weighted networks, there are no limitations, and the adjacency matrix could have any value (rather than binaries) manifesting the importance of the established connections.
We construct a directed and weighted graph to study the solar magnetic patches.We consider the incoming/outgoing magnetic intensities as the weight of connections.In this perspective, if a connection is established between pixels i and j, then A i,j is B LOS for pixel i, and A j,i is B LOS for pixel j.In case of no connectivity, A i,j is zero.Also, A i,i is considered to be zero, due to the nature of the magnetic network.The next step is to investigate the graph's properties (e.g., degree of node and PageRank).
The degree of nodes specifies how many effective connections are established in a network by measuring the number of neighbors of the nodes.By definition, the degree of the ith node of a graph is where A is the adjacency matrix (Donges et al. 2009).
Further to the node degree, we calculate the PageRank and assess its applicability in recognizing magnetic patches.The PageRank, r i , illustrates the importance (popularity) of a node based on the structure of links in a graph (Sheng et al. 2020): In this equation, the damping factor d is a constant and could adopt any value between 0 and 1.But usually, it is considered to be 0.85 (Brin & Page 1998;Mohammadi et al. 2021).
In Section 5, we discuss these properties in more detail and examine their usefulness in detecting magnetic patches.We demonstrate that the corresponding images of the degree of node and PageRank can effectively distinguish the borders of photospheric fluxes on the Sunʼs surface.

Model Properties
The solar magnetic activity could be investigated by detecting magnetic structures as they are emerging, evolving, and annihilating on the surface.Following this objective, we introduced a new algorithm based on the complex network approach to identify the photospheric magnetic patches from HMI LOS images (the relevant MATLAB and Python packages are available on GitHub, see the Data Availability section).The efficacy of the developed algorithm is assessed through the examination of various data sets and the evaluation of the networks' properties (i.e., degree of node and PageRank).
To construct a node-degree image, we compute the sum of the degrees for each pixel at a specified magnetic threshold.Subsequently, an image reflecting the node's degrees is produced, matching the magnetogram in size.Figure 2 shows the HMI magnetogram (NOAA AR 2929), and the corresponding node-degree images at various thresholds of 8, 12, 16, 20, and 24 G, from left to right, respectively.The bright and dark regions/pixels denote inward and outward links, respectively.In panel (b), numerous tiny features (consisting of one or a few pixels shown with red arrows) are observed.Increasing the magnetic field threshold to above 12 G, and constructing the complex network, results in the disappearance of most tiny features in the node-degree image.Given that the inherent noise level of the HMI magnetogram depends on the instrument's data product and the specific area of interest within the photosphere, varying thresholds may be employed for different studies.A one-to-one correspondence exists between most features in the node-degree images at thresholds more than 12 G and the HMI magnetogram patches.This oneto-one correspondence, as revealed through complex network analysis, underscores the accuracy of the magnetic patch connections.This finding highlights the utility of graph theory in analyzing densely populated magnetograms, thereby affirming its value as a tool for studying the evolution of network image features corresponding to magnetogram patches.
The borders of the node-degree image's features could be determined by applying any arbitrary region-growing method.Region growing is an image segmentation algorithm that identifies a region of interest by grouping a set of pixels around a given seed point.To connect neighboring pixels, the regiongrowing algorithm uses a threshold-base criterion (DeForest et al. 2007).Here, we apply the downhill algorithm on the node-degree images and label the features based on their connectivity, i.e., summation over all nodes' degrees within each region.Given an initial threshold, downhill divides the identified regions into smaller subregions.Figure 3 illustrates the impact of the threshold on the size of features of the nodedegree image for two active and quiet regions, panels (a) and (b), respectively.The choice of the threshold manifests no significant effect on the feature sizes in an AR (up to 150 G).However, the threshold demonstrates a more profound influence over the quiet Sun, as higher thresholds provide less accurate determinations by neglecting small features.This could particularly affect statistical studies of magnetic patches and elaborate precautions must be taken.Conventionally, downhill is employed on HMI images to identify photospheric  features.In this study, we apply it to both the degree-of-node images (indicated by the red line in Figure 4) and HMI images (indicated by the blue line in Figure 4) of an AR and a quiet Sun, using a threshold of 18 G.The results demonstrate a strong correlation between both approaches.
Figure 5 shows the HMI magnetogram (NOAA AR 2929), the node-degree, and PageRank images (panels (a), (b), and (d)).The identified features are outlined and labeled in the node-degree image of panel (c).As manifested in the figure, the HMI patches match the features of the node-degree image.We acknowledge that the original node-degree images have varying shades due to the wide range of plausible degree values.However, a uniform color scheme is applied to all the node-degree images to render a better manifestation of  borders.We observe that the borders of features identified in the node-degree image (panel (c)) are equivalent to those of HMI patches (panel (a)).
To create a PageRank image, we start by calculating the PageRank (Equation (3)) for each pixel.Next, we create an image displaying the PageRank values.We find that the absolute higher magnetic fluxes (panel (a)) result in higher values for PageRank (panel (d)), indicating that the important group of nodes in PageRank images corresponds with the highest unsigned magnetic fluxes.Most features of the PageRank images exhibit a one-to-one correspondence with the unsigned magnetic patches according to their size (small and large) and morphology.
To show the ability of the complex network to describe a magnetogram that mainly includes tiny features, we apply the algorithm to a quiet-Sun magnetogram.Hence, a similar analysis is performed on the HMI image of a quiet region recorded on 2021 July 12. Figure 6 displays a sample of a quiet-Sun HMI magnetogram and the corresponding nodedegree image constructed with a threshold of 18 G.Similar to the AR, the visibility graph approach demonstrates promising results as the identified features of both the node-degree (panel (b)) and PageRank (panel (d)) images exhibit a one-to-one correspondence to the magnetic patches.This is verified by comparing the identified borders of features (panel (c)) from the node-degree image with the HMI magnetogram (panel (a)).
The stability of the identified connections in the visibility graph approach is assessed using a masking test.For this purpose, we first produce an artificial magnetogram image as shown in Figure 7 Rerunning the test and masking any randomly selected feature consistently leads to identical outcomes irrespective of their size or degree.Even the simultaneous elimination of several patches produces minor errors in identifying tiny features.But how does this happen?Let us consider two nodes, i and j, that are connected through a third node, k.If we remove k (e.g., by masking a patch), the algorithm still searches for other possible connections.As a result, either i and j connect directly (provided that removal of k has guaranteed the visibility criterion between i and j), or they link through an intermediary node (e.g., l).This is an inherent and unique characteristic of the complex network approach that ensures reliable identification.
Magnetic patches cover the solar surface, and the atmospheric structures/phenomena originate in these regions.Nonetheless, not all the patches share the same impact on this environment.Parameters such as size, lifetime, and magnetic field strength are likely to regulate the effectiveness (importance) of magnetic patches Accordingly, in traditional algorithms, the key features were characterized based on these parameters.Alternatively, we propose the examination of magnetic connectivity.The complex network approach provides the ability to rank the magnetic patches based on their affinity (i.e., degree of nodes) and importance (i.e., PageRank) by searching for connections between opposite polarities.As previously mentioned, it is important to highlight that although the complex network connections align with the system's inherent magnetic nature (connecting opposite polarities), they are still distinct from it.However, there is a possibility of discovering commonalities between the two.Figure 8 presents the magnetic features ranked based on their overall degrees and total magnetic fields.Indeed, further investigations could provide a better understanding of this perspective and its efficiency in studies of atmospheric events.
Our investigation has demonstrated the capability of the complex network approach to identify one-to-one matches between HMI magnetic patches and features of the node-degree and PageRank images for both active and quiet regions.Therefore, this approach can be considered an efficient algorithm for identifying magnetic patches from magnetograms based on their connections with opposite polarities.One might think of the complex network approach as analogous to any other flux-based identification algorithm.Such a misinterpretation might be inspired by the fact that the networks are constructed based on magnetic intensities.However, the measure of the correlation between the magnetic field and the degree of each node, ∼0.44, suggests a clear discrepancy.Furthermore, other approaches to identification usually confront some restrictions.These limitations mainly regard the size of magnetic patches, the number of frames required to acknowledge a feature, and the choice of the intensity threshold (Hagenaar et al. 1999;Parnell 2002;Welsch & Longcope 2002;Qahwaji & Colak 2005;Caballero & Aranda 2014).

Tracking Magnetic Patches
Cross identification (tracking) of small-scale and large features across frames in a time sequence has been extensively  Tracking solar magnetic patches involves the processing and interpretation of data obtained from magnetic sensors and imaging techniques.Therefore, any tracking algorithm's accuracy is highly dependent on the identification system's robustness.Generally, a successful tracking algorithm must be able to differentiate between various features regardless of their properties (e.g., size and intensity).This is usually achieved by assigning unique labels to the magnetic patches to monitor changes in their position and possible movement patterns during their lifetimes.Following this purpose, we introduced a novel perspective to detect magnetic features on the Sunʼs surface based on the complex network approach (see Section 4), and in this section, we present a complementary routine developed to track the identified patches over time.
Here, we apply a tracking algorithm for the features of the node-degree images.Tracking these features is equivalent to tracking magnetic patches from HMI magnetograms.
The algorithm proceeds along two steps: labeling the patches and recognizing similar (magnetic-wise) areas in consecutive images.In other words, the magnetogram (its node-degree image) at time t k is compared with the succeeding record (45 s later t k+1 ), and subsequently this comparison is extended to include t k+1 with t k+2 , and so forth.The considered time resolution provides a consistent, near real-time monitoring of magnetic patches (degree-of-node features).Accordingly, for each identified patch, parameters such as the X and Y center coordinates, area, etc., are measured and updated every 45 s.A comparison between these parameters in successive frames allows the identification of small changes or developments in the magnetic patches.
We first label the consecutive magnetograms by j = 1 to M, in which M is the number of magnetograms.The magnetic patches of the first magnetogram j = 1 are assigned by a numerical labeling system ranging from 1 to N. The patches of other magnetograms will receive labels N j = 1 to N j , where N j is the number of patches for the jth magnetogram.These patches are reassigned later, with different labels referring to magnetic advancements, such as appearance, disappearance, merge, and fragmentation.A visual demonstration of such a process is presented in Figure 9.The figure illustrates the changes in the magnetic patchʼs structure/labels over 3 minutes.A new label should be added to the set when a new magnetic concentration emerges.Since this feature does not coincide with any preceding patches, a new number (essentially larger than all prior values, i.e., N) is assigned to it, joint with the letter "E" (e.g., patches No. E-34, E-36).On the other hand, if a patch does not appear in succeeding frames, its label shall not appear in the future (e.g., patch No. 4).If two or more patches merge, all of them are allocated with a new label: letter "M" joint with the number of the largest patch prior to the collision (e.g., patches No. 10 and 11 merged and the new label is M-11).In case of fragmentation, the new patches are labeled with the letter "F" joint with some new numbers (again, larger than all prior values).Finally, no changes apply to the existing labels if the same patches are identified in two successive magnetograms, i.e., one-to-one matches.
Expectedly, collisions and fragmentation always involve fluxes of the same sign.The proposed labeling system is of interest for further analysis of the statistics of magnetic patches, as it can distinguish between a brand-new emerging flux and those that appeared due to fragmentation.This approach might enhance the accuracy of studies on the lifetimes of magnetic features.
Investigation of possible equivalences between patches over time requires access to their spatial properties (e.g., area, center of intensity, borders, etc.).At this stage, two matrices containing the information of the patches' pixels (PP) and labels (PL) are established.These matrices are updated at every subsequent step.The corresponding pixels (labels) of any two successive frames (t k and t k+1 for k > 1) are allocated to the first and second columns of the PP (PL) array, respectively.The degree of overlap between the two time steps is then calculated through a comparison between both columns of the PP matrix.Those patches of t k+1 with overlaps less than 30% correspond to the emergence of magnetic features, while patches of t k with degrees below this threshold manifest disappearances.
Addressing the affinity between patches with higher degrees of overlap relies on further examination of the magnetic flux centers, respective areas, and the PL matrix.Consider l and m as two patches at times t k and t k+1 , respectively with areas of A l , and A m .Welsch & Longcope (2003) suggested that if the two flux centers are located within a distance of D where l m they are likely to be epitomes of either a one-to-one match, merge, or fragmentation.Any patch satisfying these two conditions goes through fragmentation if there are repeated values in the first column of the PL matrix since the frequent labels indicate that a patch from the first image is related to multiple patches from the second image.Similarly, a recurrence of labels in the second column of the PL matrix suggests merging conditions, as it indicates that multiple patches from the first image are connected to a single patch from the second image.Labels that appear only once in both columns are classified as one-to-one matches.
To appraise the efficacy of the complex network approach, a comparative analysis is conducted with the conventional solar magnetic patch identification algorithm of YAFTA (an animation, showing the frame-by-frame tracking process of the YAFTA method and the present algorithm, is available online). Figure 10 shows how each algorithm functions over a 20 minute tracking period with a magnetic field threshold of 18 G.Conducting a robust comparison between these approaches is challenging due to their distinct feature recognition methodologies.Specifically, the algorithm subdivides a large patch (for instance, patch number O-25 in the left panel) into several smaller segments, whereas the complex network method interprets it as a single entity.DeForest et al. (2007) acknowledged that such fragmentation may serve specific purposes, such as tracking movements on the solar surface, but may not be optimal for quantifying the magnitude or intensity of the features.This segmentation can lead to increased noise and partial loss of the patch, which may compromise its suitability for statistical analysis.
We track the identified patches automatically across consecutive frames to assess the algorithm's capability in detecting small patches.An event is likely without noise if it persists across two or more successive magnetograms.However, background fluctuations may lead to small-scale patches (one or two pixels) to either appear (false-positive error) or disappear (false-negative error) within a single frame.To address false-positive errors, we compare the small patches within magnetogram n with those in the adjacent magnetograms of n + 1 and n − 1. Accordingly, a small patch appearing solely in one frame is classified as noise and subsequently removed.
Figure 11 shows an example of three consecutive HMI magnetograms with a time cadence of 45 s, and their detected patches correspond to the node-degree features.Among the 39 small-scale features identified in the middle frame, four failures were observed in the identification of small-scale patches within an image that appeared in the preceding and following node-degree images corresponding to the HMI magnetogram (indicated by the green arrows).A similar analysis across additional frames reveals an average of 1% false-negative error, which reflects the inability to identify small-scale patches in an image despite their appearance in the preceding and subsequent node-degree image.These features are primarily events without noise.The complex network approach successfully identifies small-scale patches (even those as small as one pixel).Yet, the choice of background intensity significantly influences the accuracy of identifications (Figure 2).A sample frame of the labeled degree of nodes features one-to-one magnetic patches that identified and tracked by the present complex network approach (left panel).A sample frame of the labeled magnetic patches was identified and tracked by YAFTA (right panel).The online animation includes two parts: 28 slides of consecutive frames including the labeled magnetic patches that were identified and tracked by applying YAFTA on HMI magnetograms, and 28 slides of consecutive degree-of-node frames including the labeled node-degree features that correspond to one-toone HMI magnetic patches by applying the complex network approach.(An animation of this figure is available.) The dependency of the present method on the predefined threshold intrinsically differs from the previous algorithms.The susceptibility of other approaches to identification to noise and misidentifications mostly originates in the applied regiongrowing algorithm.On the other hand, the relatively unfavorable (noisy-like) identification of the visibility graph method at low thresholds corresponds to the small fragments of the photospheric magnetic carpet (Figures 1(d) and 2).In other words, the noisy-like features might be of interest depending on the intended study, and various levels of accuracy are convenient.
Graph theory, which satisfies the visibility graph condition, illustrates the connection between opposite polarities.The developed complex network approach constructs the nodedegree and PageRank images that reveal both small and large features that mostly correspond one-to-one with magnetic patches.The alignment observed in the node-degree images supports the validity of the network method, meeting a straightforward criterion for linking opposite polarities.This method facilitates the identification of magnetic patches by matching them with features in the degree-of-node images.The downhill algorithm was applied to group neighboring pixels into features of a node-degree image.We conducted the analyses on several data sets and found that the suggested visibility-graphbased algorithm serves promisingly as a means of identification.Additionally, the complementary tracking algorithm successfully separates features from noise.The method uses the distance criteria (Equation ( 4)) and the overlapping regions criteria (Section 5.1) to monitor and track features across successive node-degree images.The tracking algorithm identifies tiny regions (consisting of one or two pixels) as real (without noise) features if they occur in at least two consecutive node-degree images.We find an average false-negative error rate of about 1% in detecting tiny features.The routine remarkably succeeds in the fast recognition of magnetic patches in a sequence of magnetograms.As the next step, we intend to investigate the statistics of solar magnetic patches from LOS magnetograms and the radial component.We aim to discern noise from tiny features in photospheric regions such as sunspots.
Figure 11.Consecutive HMI magnetograms with the cadence of 45 s (top panels) together with the identified features from the node-degree images constructed with the network approach (bottom panels).The patches with green arrows correspond to the small-scale events of the corner panels that were not detected in the middle frame.

Figure 1 .
Figure 1.An HMI cutout image of the Sun taken by the SDO at 23:58 on 2022 January 17.As manifested in this graphical illustration, an arbitrary pixel can connect an opposite polarity (red asterisks) only if their magnetic intensities exceed the absolute values of all the pixels placed in between them (marked with blue flags in panel (b)).The absolute intensities of negative and positive fluxes are shown with black and white bars in panel (c), respectively.A partial 3D visualization of the magnetic connections that hold in the constructed network is displayed in panel (d).The heights of connections represent their weights.

Figure 2 .
Figure 2. (a) The HMI cutout image of an AR recorded by the SDO at 23:58 on 2022 January 17 (NOAA AR 2929).Panels (b)-(f) show the node-degree image for the magnetic network constructed from the HMI magnetogram with thresholds of 8, 12, 16, 20, and 24 G, respectively.The bright and dark regions/pixels indicate the inward and outward links, respectively.The node-degree images are the same size as the original cutout HMI magnetogram.

Figure 3 .
Figure 3. Feature sizes for various choices of threshold applying the downhill algorithm: (a) in a node-degree image corresponding to an AR; (b) in a node-degree image related to a quiet Sun.

Figure 4 .
Figure 4. Frequency-size distribution of magnetic patches identified by the conventional downhill technique (blue line) and features of a node-degree image (red line) for an AR (a) and a quiet Sun (b).

Figure 5 .
Figure 5. (a) The HMI cutout image of an AR recorded by the SDO at 23:58 on 2022 January 17 (NOAA AR 2929).The selected window size is 75 × 75 pixels.The complex network is constructed considering a threshold of about 20 G. (b) The node-degree image.(c) The identified regions of the node-degree image correspond to magnetic patches.(d) The PageRank image.In the PageRank image, bright pixels indicate high PageRank values.The PageRank image is the same size as the original cutout HMI magnetogram.
(a).This simulated magnetogram comprises a 100 × 100 pixel image featuring randomly generated background levels, with absolute values of the background less than 17 G.The image also includes 70 patches of positive and negative polarities, with values exceeding the threshold.The second panel of Figure 7 displays the corresponding node-degree image, delineating the boundaries in red and including the patch labels.As a next step, we manually remove (mask) the largest patch (i.e., patch No. 55) and the patch with the highest degree (i.e., patch No. 4) and reassess the connections.The new nodedegree images are presented in panels (c) and (d), respectively.It is observed that valid connections are established despite the removal of prominent features from the study.

Figure 6 .
Figure 6.(a) The HMI cutout image of a quiet region recorded by the SDO at 23:59 on 2022 July 12.The selected window size is 113 × 101 pixels.The complex network is constructed considering a threshold of about 18 G.(b) The node-degree image.(c) The identified node-degree regions corresponding to magnetic patches.(d) The PageRank image.

Figure 7 .
Figure 7. (a) An artificial magnetogram of 100 × 100 pixels, featuring randomly generated background levels with the absolute values of the background less than 17 G.(b) The original node-degree image.Panels (c) and (d) represent the node-degree image after masking the largest patch (i.e., patch No. 55) and the patch with the highest degree (i.e., patch No. 4), respectively.

Figure 8 .
Figure 8.The identified magnetic patches ranked by numbers according to (a) the total degree of the nodes, (b) the average degree of the nodes for pixels (divided by patch size), (c) the total magnetic field, and (d) the average magnetic field for pixels (divided by patch size).

Figure 9 .
Figure 9.The HMI cutout image of an AR (NOAA AR 2989) recorded at 23:59 on 2022 April 13 (left panel) and the taken 3 minutes later (right panel).The selected window size is 75 × 75 pixels.The complex network is constructed considering a threshold of 18 G.Patch borders and labels are indicated in red and blue, respectively.According to the introduced tracking and labeling system, patches such as O-6, O-3, and O-7 are one-to-one matches, while patches like 10 and 11 merge and are relabeled as M-11.Patches E-26 and E-35 appear and patches 5 and 26 disappear in the right panel.Patch 8 fragments and is assigned with a new label as F1-37.To avoid a cluttered presentation, labels of the small patches are not indicated.

Figure 10 .
Figure10.The tracking of magnetic patches was compared for 20 minutes.A sample frame of the labeled degree of nodes features one-to-one magnetic patches that identified and tracked by the present complex network approach (left panel).A sample frame of the labeled magnetic patches was identified and tracked by YAFTA (right panel).The online animation includes two parts: 28 slides of consecutive frames including the labeled magnetic patches that were identified and tracked by applying YAFTA on HMI magnetograms, and 28 slides of consecutive degree-of-node frames including the labeled node-degree features that correspond to one-toone HMI magnetic patches by applying the complex network approach.(An animation of this figure is available.)